note 123713 deleted from function.file-get-contents by cmb
| From: | cmb@php.net | Date: | Thu, 21 Mar 2019 12:15:27 +0000 |
| Subject: | note 123713 deleted from function.file-get-contents by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210420@lists.php.net to get a copy of this message | ||
Note Submitter: admin at iraqnownews dot com
----
code for get og:image from url on feed rss xml
$doc = new \DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML(file_get_contents($rssLink));
$query = '//*/meta[starts-with(@property, \'og:image\')]';
$xpath = new \DOMXPath($doc);
$metas = $xpath->query($query);
foreach ($metas as $meta) {
$property = $meta->getAttribute('property');
$content = $meta->getAttribute('content');
if (!empty($content)) {
$image = $content;
}
}
http://iraqnownews.com