Open socket and read : Socket : Network PHP Source Code


PHP Source Code » Network » Socket »

 

Open socket and read



<?php
   // Establish a port 80 connection with www.example.com
   $http = fsockopen("www.navioo.com",80);

   // Send a request to the server
   $req = "GET / HTTP/1.1rn";
   $req .= "Host: www.navioo.comrn";
   $req .= "Connection: Closernrn";
   fputs($http, $req);

   // Output the request results
   while(!feof($http)) {
      echo fgets($http, 1024);
   }

   // Close the connection
   fclose($http);

?>


           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Network
» Socket