Outputting Server Status Lines
$to_check = array (
"www.google.com" => "/index.html",
"www.html.com" => "/notthere.html",
"www.java.com" => "/nohost.html"
);
foreach ( $to_check as $host => $page ) {
print "";
$fp = @fsockopen( "$host", 80, $errno, $errdesc, 10);
print "Trying $host
";
if ( ! $fp ) {
print "Couldn't connect to $host:
";
print "Error: $errno
";
print "Desc: $errdesc
";
} else {
print "Trying to get $page
";
fputs( $fp, "HEAD $page HTTP/1.0" );
fputs( $fp, "Host: $host" );
fputs( $fp, "\r\n" );
print fgets( $fp, 1024 );
fclose( $fp );
}
print "
\n";
}
?>