Here is the final version for anyone that might need something similar... we found that there was a small issue with urls that had an ending slash... fixed.
Code:
<?php
$url = 'http://www.crazyfilth.com';
$anchor_text = 'Porn Videos';
$html = file_get_contents('http://aisle69.com/');
echo checkUrl($url, $anchor_text, $html);
function checkUrl($url, $anchor_text, $html) {
$found = false;
$dom = new domDocument();
@$dom->loadHTML($html);
$anchors = $dom->getElementsByTagName('a');
foreach ($anchors as $anchor) {
$found_url = preg_replace('{/$}', '', $anchor->getAttribute('href'));
$urltext = trim($anchor->nodeValue);
if (($found_url == $url) && ($anchor_text == $urltext)) {
return true;
}
}
return false;
}
?>