- substr: documentation ( source)
- file_get_contents: documentation ( source)
- mb_convert_encoding: documentation ( source)
- get_headers: documentation ( source)
- parse_url: documentation ( source)
<?php
$score_url = 'http://vowgag.com/to/23335/';
$headers = get_headers($score_url);
$response = substr($headers[0], 9, 3);
$html = file_get_contents($score_url);
$html2 = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8");
$classname = 'entry-content';
$ogtitle = 'og:title';
$dom = new DOMDocument;
$dom->loadHTML($html2);
$xpath = new DOMXPath($dom);
//$results = $xpath->query("(//div[@class='" . $classname . "'])[1]/p/a[1]");
$results2 = $xpath->query("(//div[@class='" . $classname . "'])[1]/p/a[1]/img[1]/@src");
$results3 = $xpath->query("//meta[@property='" . $ogtitle . "']/@content");
foreach ($results2 as $parseimg){
$parseimgurl = parse_url($parseimg->nodue."");
}
echo $parseimgurl;