Outputting the Status Lines Returned by Web Servers : Socket : Network PHP Source Code


PHP Source Code » Network » Socket »

 

Outputting the Status Lines Returned by Web Servers



<html>
<head>
<title>Outputting the status lines returned by web servers</title>
</head>
<body>
<?php
$to_check = array ("www.navioo.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: $errnon<br>Desc:$errdescn";
        print "<br><hr><br>n";
        continue;
    }
    print "Trying to get $page<br>n";
    fputs$fp, "HEAD $page HTTP/1.0rnrn" );
    print fgets$fp, 1024 );
    print "<br><br><br>n";
    fclose$fp );
}
?>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Network
» Socket