Sockets Are Files : fsockopen « File Directory « PHP

Sockets Are Files

    $fp = fsockopen ("", 80);

    if ($fp) {
            fwrite($fp, "GET / HTTP/1.1\r\nHOST:\r\n\r\n");

            while (!feof($fp)) {
                    print fread($fp,256);

            fclose ($fp);
    } else {
            print "Fatal error\n";

Related examples in the same category

1.Outputting the Status Lines Returned by Web Servers
2.fsockopen() function establishes a socket connection, TCP or UDP.
4.SSL Streams
5.Scan a server
6.Retrieving a Web Page Using fsockopen()