OK Dan,
I added your suggested changes.
Thanks,
Néstor :-)
On 1/4/07, Dan Cech <[EMAIL PROTECTED]> wrote:
Néstor wrote:
> OK guys,
>
> Just in case you are interested, I found a faster solution than fopen()
>
>
--------------------------------------------------------------------------------------------------
I've corrected some things for you:
<?
function url_exists($strURL) {
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $strURL);
// return the result instead of echoing it
curl_setopt($resURL, CURLOPT_RETURNTRANSFER, 1);
// time out after 5 seconds of no response
curl_setopt($resURL, CURLOPT_TIMEOUT, 5);
$result = curl_exec ($resURL);
if ($result === false) {
curl_close($resURL);
return false;
}
$intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
curl_close ($resURL);
if ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode !=
304) {
return false;
}
return true;
}
//Usage Example :
If(url_exists("http://www.weberdev.com/addexample.php3")) {
Echo"URL Exists";
}Else{
Echo"URL doesnot exist";
}
?>
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php