Re: Meaningful URL Validator

From: Date: Fri, 17 Aug 2001 09:11:08 +0000
Subject: Re: Meaningful URL Validator
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63160@lists.php.net to get a copy of this message
<?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" <sos@LinCom.no> To: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#63160) next »