Fandt en løsning:
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$html = file_get_contents_curl("
http://www.eksperten.dk/spm/950255");
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('title');
$nodes2 = $doc->getElementsByTagName('meta');
$title = $nodes->item(0)->nodeValue;
if($nodes2->getAttribute('name') == 'description') {
$description = $nodes2->getAttribute('content');
}
echo "Title: $title". '<br/>';
echo "Description: $description";