Hi all
I'm trying to built a function which will check if a given url and linktext exists on another given webpage.
This is what I've done so far using regular expressions:
function islinking($linkurl,$linktext,$clienturl)
{
$curl = curl_init($linkurl);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$file = curl_exec($curl);
curl_close($curl);
$s=0;
preg_match_all('/<a[^>]*?href=[\'"]'.gethost($clienturl).'[\'"][^>]*?>'.$linktext.'<\/a>/si',$file,$matches);
$matches = $matches[0];
$s=count($matches);
if ($s>0) return true;
else return false;
}
The function should return true if the clienturl and the linktext were found on the linkurl page, but it only returns false.
I'm not very good with regular expressions, any help is appreciated.