Forum Moderators: coopster

Message Too Old, No Replies

PHP and URL

verify is exist

         

c0nsur

1:56 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



hi guys once again thanks for repplying all my msg :)

ok here s another question,

how could i verify if an url exists and works :)

dmorison

1:59 pm on Aug 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your installation of PHP has URL wrappers enabled (it probably does); just use an fopen on the entire URL:

$url="http://www.example.com/foo/bar.html";

if ($f=fopen($url))
{
echo "OK!";

fclose($f);
}
else
{
echo "ERROR!";
}

bcolflesh

2:02 pm on Aug 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, if you have the libcurl library installed, you have access to many url verification functions:

us3.php.net/curl