php-fsockopen-demo

<?php

function Httpxlxz($ip, $host, $url)
{
    $response   = '';
    $errstr = '';
    $errno = '';
    $fp = fsockopen ($ip, 80, $errno, $errstr, 90);
    if ( ! $fp )
        return false;     

        $out = "GET {$url} HTTP/1.1\r\n";
        $out .= "Host:{$host}\r\n";
        $out .= "Connection: close\r\n\r\n";
        fputs ($fp, $out);     

        while($line = fread($fp, 14096)){
           $response .= $line;
        }
        fclose( $fp );  

        //去掉Header头信息
        $pos = strpos($response, "\r\n\r\n");
       $response = substr($response, $pos + 4);  

        return $response;
}

//调用方法:
$server_info1 = Httpxlxz("27.120.120.25", "qqsq.net", "/index.php");  

var_dump( $server_info1 );