Sockets Are Files : fsockopen « File Directory « PHP






Sockets Are Files

 
<?
    $fp = fsockopen ("data.org", 80);

    if ($fp) {
            fwrite($fp, "GET / HTTP/1.1\r\nHOST: data.org\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.
3.fsockopen.php
4.SSL Streams
5.Scan a server
6.Retrieving a Web Page Using fsockopen()