来源ip,,,1.php 请求 2.php 。
1.php代码:
$ch = curl_init();
curl_setopt($ch, curlopt_url, http://localhost/2.php);
curl_setopt($ch, curlopt_httpheader, array('x-forwarded-for:8.8.8.8', 'client-ip:8.8.8.8')); //构造ip
curl_setopt($ch, curlopt_referer, http://www.gosoa.com.cn/ ); //构造来路
curl_setopt($ch, curlopt_header, 1);
$out = curl_exec($ch);
curl_close($ch);
2.php代码如下:
function getclientip() {
if (!empty($_server[http_client_ip]))
$ip = $_server[http_client_ip];
else if (!empty($_server[http_x_forwarded_for]))
$ip = $_server[http_x_forwarded_for];
else if (!empty($_server[remote_addr]))
$ip = $_server[remote_addr];
else
$ip = err;
return $ip;
}
echo ip: . getclientip() . ;
echo referer: . $_server[http_referer];
http://www.bkjia.com/phpjc/371880.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/371880.htmltecharticle来源ip,,,1.php 请求 2.php 。 1.php代码: $ch = curl_init(); curl_setopt($ch, curlopt_url, http://localhost/2.php); curl_setopt($ch, curlopt_httpheader, array('x-forwa...