HTTP sockets
Posted: Thu Jul 09, 2009 11:24 am
Code: Select all
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
.......
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: http://www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}