fsockopen.php : fsockopen « File Directory « PHP






fsockopen.php

 
<?php
   $http = fsockopen("www.example.com",80);

   $req = "GET / HTTP/1.1\r\n";
   $req .= "Host: www.example.com\r\n";
   $req .= "Connection: Close\r\n\r\n";

   fputs($http, $req);

   while(!feof($http))
   {
      echo fgets($http, 1024);
   }

   fclose($http);

?>
  
  








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.SSL Streams
4.Sockets Are Files
5.Scan a server
6.Retrieving a Web Page Using fsockopen()