$host = "www.php.net";
$url = "/index.php";
$fp = fsockopen($host, 80);
socket_set_blocking($fp, TRUE);
fwrite($fp, "GET $url HTTP/1.0\r\nHost: $host\r\n\r\n");
for($result = ""; !feof($fp); $result .= fread($fp, 10000000));
fclose($fp);
// Optionally extract headers with something like
// $result = substr($result, 0, strpos($result, "\r\n\r\n"));
echo !stristr($result, "404 Not Found") ? "OK" : "Bad";