日期:2014-05-17 浏览次数:20426 次
$out = "POST $path HTTP/1.1\r\n";
$out .= "Accept: */*\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out.="X-Forwarded-For: ".$ip."\r\n"; //主要是这里来构造IP
$out .= "Host: ".$domain_ip."\r\n";
$out .= "Content-Length: ".$content_length."\r\n";
$out .= "Connection: close\r\n\r\n";
$out .= $content."\r\n\r\n"; //提交的内容
if (getenv("HTTP_X_FORWARDED_FOR"))
{
$ip = getenv("HTTP_X_FORWARDED_FOR");
}
elseif (getenv("HTTP_CLIENT_IP"))
{
$ip = getenv("HTTP_CLIENT_IP");
}
elseif (getenv("REMOTE_ADDR"))
{
$ip = getenv("REMOTE_ADDR");
}
else
{
$ip = "";
}