您好,欢迎访问一九零五行业门户网

php伪造IP地址与来源程序代码

在php中要伪造ip和来源是很方便的事情,我们只要不超过10行代码即可实现,下面我来介绍利用php中curl函数来操作。
下面写个构造来路google.com代码
 代码如下 复制代码
$ch = curl_init();
curl_setopt($ch, curlopt_url, http://www.111cn.net/);
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.baidu.com/ ); //构造来路
curl_setopt($ch, curlopt_header, 1);
$out = curl_exec($ch);
curl_close($ch);
我们常用的获取ip来源的函数
 代码如下 复制代码
function getclientip() {
     if (!emptyempty($_server[http_client_ip]))
     $ip = $_server[http_client_ip];
     else if (!emptyempty($_server[http_x_forwarded_for]))
     $ip = $_server[http_x_forwarded_for];
     else if (!emptyempty($_server[remote_addr]))
     $ip = $_server[remote_addr];
     else
     $ip = err;
     return $ip;
     }
得出的结果是我们为造的ip地址来源哦。
echo
ip: . getclientip() . ;
echo
referer: . $_server[http_referer];
得出结果是我们的ip地址:8.8.8.8 来路 baidu.com 成功了吧。
其它类似信息

推荐信息