php get main image of webpage
<?php $html = file_get_contents('http://www.website.any'); preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i',$html, $matches ); echo $matches[ 1 ][ 0 ]; //or libxml_use_internal_errors(true); // Yeah if you are so worried about using @ with warnings $doc = new DomDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $query = '//*/meta[starts-with(@property, \'og:\')]'; $metas = $xpath->query($query); $rmetas = array(); foreach ($metas as $meta) { $property = $meta->getAttribute('property'); $content = $meta->getAttribute('content'); $rmetas[$property] = $content; } var_dump($rmetas); // or Using https://github.com/scottmac/opengraph $graph = OpenGraph::fetch('http://www.avessotv.com.br/bastidores-pantene-institute-experience-pg.html'); print_r($graph); ?>