Re: [PHP3] Checking of a link exists or not

From: Date: Fri, 09 Jun 2000 22:27:01 +0000
Subject: Re: [PHP3] Checking of a link exists or not
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1476@lists.php.net to get a copy of this message
In article <00e201bfd0ba$2817b500$0201a8c0@ping>, jerry@lucard.to ("Jerry Verhoef") wrote: > I trying to make a script that checks if an URL is correct and alive > this what i got so far but it is not working properly. I think i am doing > something wrong with the Headers to the server. Might be easier to just do: if ($url = fopen($u)){ echo "$u is valid"; fclose($url); } else{ echo "$u is down or invalid"; } > > http://www.lucard.to/test/check.phtml?u=http://www.lucard.to/test/check.phtm > l source code and demo. > for ppl who don't want to visit: > $fp = fsockopen($url[host],80); > if ($fp) > { > set_socket_blocking($fp,false); > $path = "HEAD ".$url[path]." HTTP/1.0 \r\n\r\n"; > fputs($fp, $path); > while($str = fgets($fp, 1024)) > { > echo $str; > } > > Any hints at all are helpful :) > > Jerry Verhoef > http://php.start4all.com -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#1476) next »