note 78655 deleted from language.types.string by felipe

From: Date: Sun, 16 Dec 2007 12:00:30 +0000
Subject: note 78655 deleted from language.types.string by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133678@lists.php.net to get a copy of this message
Note Submitter: ktcb123 at hotmail dot com ---- For some reason, none of the url_exists() functions posted here worked for me, so here is my own tweaked version of it. <?php function url_exists($url){ $url = str_replace("http://", "", $url); if (strstr($url, "/")) { $url = explode("/", $url, 2); $url[1] = "/".$url[1]; } else { $url = array($url, "/"); } $fh = fsockopen($url[0], 80); if ($fh) { fputs($fh,"GET ".$url[1]." HTTP/1.1\nHost:".$url[0]."\n\n"); if (fread($fh, 22) == "HTTP/1.1 404 Not Found") { return FALSE; } else { return TRUE; } } else { return FALSE;} } ?>

« previous php.notes (#133678) next »