I have this function that gets fed a url and a couple of search terms that are known to be in the url. Unfortunately, not all urls pass, even though they exist.
this url does not get confirmed:
<snip>
--------
whereas, this one does:
<snip>
both contain the word 'tie'.
what could be missing? I tried dropping the case of the site, but that didn't help.
-------------------------------
function urlExists($url=NULL, $findme, $findme2)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 1600);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1600);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = strtolower(curl_exec($ch));
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$pos = strpos($data, $findme);
$pos2 = strpos($data, $findme2);
if ($pos == true) {
print("<span style='color:#00FF00'>".$url."</span><BR>");
return true;
}
elseif ($pos2 == true) {
print("<span style='color:#00FFf0'>".$url."</span><BR>");
return true;
}
}
[edited by: dreamcatcher at 7:28 am (utc) on Jun 10, 2010]
[edit reason] No urls please. See TOS. [/edit]