<html>
<head>
<title>Outputting the status lines returned by web servers</title>
</head>
<body>
<?php
$to_check = array ("www.java2java.com" => "/index.htm");
foreach ( $to_check as $host => $page ){
$fp = fsockopen( "$host", 80, &$errno, &$errdesc, 10);
print "Trying $host<BR>\n";
if ( ! $fp ){
print "Couldn't connect to $host:\n<br>Error: $errno\n<br>Desc:$errdesc\n";
print "<br><hr><br>\n";
continue;
}
print "Trying to get $page<br>\n";
fputs( $fp, "HEAD $page HTTP/1.0\r\n\r\n" );
print fgets( $fp, 1024 );
print "<br><br><br>\n";
fclose( $fp );
}
?>
</body>
</html>
|