what is the best way to get og:image meta property

php, zend-framework

Solution

This is how I used to get all the og:tags:

libxml_use_internal_errors(true);
$doc = new DomDocument();
$doc->loadHTML(file_get_contents($url));
$xpath = new DOMXPath($doc);
$query = '//*/meta[starts-with(@property, \'og:\')]';
$metas = $xpath->query($query);
foreach ($metas as $meta) {
    $property = $meta->getAttribute('property');
    $content = $meta->getAttribute('content');
    echo '<h1>Meta '.$property.' <span>'.$content.'</span></h1>';
}

Problem

I am trying to show rss feed links in my website, All going well but its taking so much time to get og:image property by using `file_get_contents()` method. Is there any other way to fetch meta tag properties? Is Python helpful to get these tags faster ?

Original source

Related problems