Voting

: two plus zero?
(Example: nine)

The Note You're Voting On

ktcb123 at hotmail dot com
17 years ago
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;}
}
?>

<< Back to user notes page

To Top