基于curl的IP信息修改

$ip = "10.10.10.10";
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($ch,CURLOPT_HTTPHEADER,array("Client_Ip: ".$ip."nReal_ip: ".$ip."nX_FORWARD_FOR:
".$ip."nX-forwarded-for: ".$ip."nPROXY_USER: ".$ip."n"));
curl_setopt($ch, CURLOPT_URL,"http://ip138.com/ip2city.asp");
echo curl_exec($ch);
curl_close($ch);

2 评论

  1. 提示
    Bad Request

    Your browser sent a request that this server could not understand.
    Request header field is missing ':' separator.
    10.10.10.10

    请问是为什么呢?谢谢博主

发表评论

电子邮件地址不会被公开。 必填项已用*标注