<?php
header
("content-type:text/html;charset=utf-8");
highlight_file(__FILE__);
function 
GetFile($host$port$link)
{
    
$link str_replace('..','',$link);
    
//fsockopen() 将返回一个文件句柄,之后可以被其他文件类函数调用
    //(例如: fgets() , fgetss() ,
    // fwrite() , fclose() 还有 feof() )。如果调用失败,将返回 FALSE 。
    
$fp fsockopen($hostintval($port), $errno$errstr30);
    if (!
$fp) {
        echo 
"$errstr (error number $errno) \n";
    } else {
        
$out "GET $link HTTP/1.1\r\n";
        
$out .= "Host: $host\r\n";
        
$out .= "Connection: Close\r\n\r\n";
        
$out .= "\r\n";
        
fwrite($fp$out);
        
$contents '';
    while (! 
feof($fp)) {
        
$contents .= fgets($fp1024);
    }
    
fclose($fp);
    return 
$contents;
    }
}
$host $_GET['host'];
$port $_GET['port'];
$link $_GET['link'];
echo 
GetFile($host$port$link);
?>

Connection refused (error number 111)