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.

What does gethost($clienturl) return ? If it contains forward slashes the unexpected result can be explained, because they need to be escaped.

What does gethost($clienturl) return ? If it contains forward slashes the unexpected result can be explained, because they need to be escaped.

function getHost($Address)
 { 
    $parseUrl = parse_url(trim($Address)); 
    return trim($parseUrl[host] ? $parseUrl[host] : array_shift(explode('/', $parseUrl[path], 2))); 
 }