<?php
$url = "http://url";;
if($file = @file($url))
die("Invalid");
for($i=0;$i<sizeof($file);$i++)
{
if(eregi("<b>404</b>", $file[$i]))
  die("Invalid");
if(eregi(">404 ", $file[$i]))
  die("Invalid");
if(eregi("404 Error", $file[$i]))
   die("Invalid");
if(eregi("not exist", $file[$i]))
   die("Invalid");
}
echo $url." is Valid";
?>
----- Original Message -----
From: "Stig-rjan Smelror" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 17, 2001 6:59 PM
Subject: [PHP] Meaningful URL Validator


> Hi all,
>
> I'm trying to make an URL validator, but I'm kind of stuck now.
>
> What I awnt it to do is as follows:
>
> It first checks to see if the server is up or down by doing a general
> fopen() on the URL.
>
> It then opens the URL in some way, checks the HTTP response code and
> spews out a meaningful message to the user.
> E.g. if it's a 404, the user will get a message saying the the page was
> not found.
>
> Has anybody done this before and have the kind heart to share it with me?
;)
>
>
> TIA
>
> --
> Stig-rjan Smelror
> Systemutvikler
>
> Linux Communications AS
> Sandakerveien 48b
> Box 1801 - Vika
> N-0123 Oslo, Norway
>
> tel. +47 22 09 28 80
> fax. +47 22 09 28 81
> http://www.lincom.no/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to