Possible Duplicate:
How to parse and process HTML/XML with PHP?
I want to find the backlink in the html source code. See the code below.
But I want to find anchor tags that don't have a rel='nofollow'
attribute.
Example:
<a href='http://domain.com/abd/ff/' rel='nofollow'>
Regex:
if(preg_match("/<a(.*)href=[\"']".$match_pattern."(\/?)[\"'](.*)>(.*)<\/a>/", $part)){...}
Function:
function check_back_link($remote_url, $your_link) {
$match_pattern = preg_quote(rtrim($your_link, "/"), "/");
$found = false;
if($handle = @fopen($remote_url, "r")){
while(!feof($handle)){
$part = fread($handle, 1024);
if(preg_match("/<a(.*)href=[\"']".$match_pattern."(\/?)[\"'](.*)>(.*)<\/a>/", $part)){
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}