, . ,
telnet localhost 80
? localhost, ip . , curl/php.
: ok, localhost , file_get_contents("http://localhost/");.
, localhost, Host:, . cURL, :
curl_setopt(CURLOPT_HTTPHEADER,array('Host: yourdomain.com'));
URL http://127.0.0.1/. , , .
edit ^ 2: cURL, :
$ip = '127.0.0.1';
$fp = fsockopen($ip, 80, $errno, $errstr, 5);
$result = '';
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.exampl.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
}
( php.net)