Created
April 25, 2022 04:00
-
-
Save riedayme/3f8d35d6168cf2e0c5d3f1dbe0181326 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function XPath($content){ | |
$previous_value = libxml_use_internal_errors(TRUE); | |
$dom = new \DOMDocument; | |
$dom->loadHTML($content); | |
libxml_clear_errors(); | |
libxml_use_internal_errors($previous_value); | |
$xpath = new \DOMXPath($dom); | |
return [$dom,$xpath]; | |
} | |
$echo = file_get_contents('https://photos.app.goo.gl/rXxgRTfNovBZJBUX6'); | |
$xpath = XPath($echo); | |
$url = $xpath[1]->query("//meta[@property='og:image']/@content"); | |
if ($url->length == 0) { | |
echo "No description meta tag :("; | |
} else { | |
foreach ($url as $content) { | |
echo $content->value ; | |
} | |
} | |
?> | |
<!-- <meta property="og:image" content="https://lh3.googleusercontent.com/WMx9Sh7KkOg0lQxcfowBZ4UIYQADr7oUB6-7tenmMIKYSu9MkunHFOSR64m2afCAOsPY7oivRWAbgjEStQ0Yb3AR02Yt0E5C549WDhKuDJzOIdNWkX7IZqzNTi7rJ8wDKjY6pttHoA=w566-h130-p-k"> | |
<meta property="og:image" content="https://lh3.googleusercontent.com/WMx9Sh7KkOg0lQxcfowBZ4UIYQADr7oUB6-7tenmMIKYSu9MkunHFOSR64m2afCAOsPY7oivRWAbgjEStQ0Yb3AR02Yt0E5C549WDhKuDJzOIdNWkX7IZqzNTi7rJ8wDKjY6pttHoA=w566-h130-p-k"> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment