如何检测另一个网站的元标记?

I am trying to verify that someone actually owns the site that they claim to own. I need to detect a meta tag that I give them with a unique code. How can I go about doing this?

This would detect and print out the meta tag:

<?php

$html = file_get_contents('http://example.com');

$dom = new DOMDocument();

$dom->loadHTML($html);

$xpath = new DOMXPath($dom);

$element = $xpath->query('//meta');

// item(0) returns the 1st meta string, item(1) returns the 2nd meta string
$element = $element->item(0);

$result = $dom->saveXML($element);

$result = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $result);

echo htmlspecialchars($result);

?>