i çalıştıran aşağıdaki kodu var, ama yine de vücut etiketi içinde geçerli ... emin değil ne yanlış olmayan bir exteranl web sayfasında bir bağlantı görüyor ...
$dom = new DOMDocument();
@$dom->loadHTML($get_webpage);
@$dom->getElementsByTagName('body');
$x = new DOMXPath($dom);
foreach($x->query("//a") as $node)
{
if ($node->getAttribute("href") == "http://www.mysite.com/" && $node->getAttribute("rel") == "" && $node->textContent == "mysite")
{
// echo 'valid link on site';
}
}
Harici web sayfası
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<a href="http://www.mysite.com/"><strong>mysite<strong></a>
<body>
text text
</body>
</html>