test1.php ?phpob_start();$ch = curl_init();curl_setopt($ch, curlopt_url, http://www.xxx.cn/test/test2.php);curl_setopt($ch, curlopt_httpheader, array('x-forwarded-for:1.1.1.1', 'client-ip:2.2.2.2')); //伪造ipcurl_setopt($ch, curlopt_refe
test1.php
test2.php
执行结果:
http/1.1 200 okserver: dws/01.03z33date: mon, 09 jun 2014 09:27:09 gmtcontent-type: text/htmltransfer-encoding: chunkedconnection: keep-alivevary: accept-encodingip: 2.2.2.2 http_client_ip-: 2.2.2.2 http_x_forwarded_for-: 1.1.1.1 remote_addr-: 127.0.0.1 referer: http://www.oicto.com/
但是暂时还无法伪造骗过:
$_server[remote_addr]。
所以建议大家记录ip时使用$_server[remote_addr]。
原文地址:php使用curl伪造来源ip与网址, 感谢原作者分享。