来源:http://www.jb51.net/article/31694.htm
curl 它不但可以模仿用户登录,还可以模仿用户IP地址哦,为伪造IP来源,本实例仅供参考哦
//伪造ip for ($i=0; $i <100 ; $i++) { $ch = curl_init(); $url = "http://www.shixiseng.com/cheerstation/csa_jyeqxortcqo0";//实习僧的防刷 //$url = "http://www.ciweishixi.com/forum/ins-1264"; //刺猬社区的文章 //$url = "http://www.cnblogs.com/xs-yqz/p/7601048.html";//个人博客防刷 $header = array( array( 'CLIENT-IP:58.68.44.21', 'X-FORWARDED-FOR:58.68.44.21', ), array( 'CLIENT-IP:528.68.44.21', 'X-FORWARDED-FOR:528.68.44.21', ), array( 'CLIENT-IP:18.62.414.22', 'X-FORWARDED-FOR:18.62.414.22', ), array( 'CLIENT-IP:122.162.44.12', 'X-FORWARDED-FOR:122.162.44.12', ), ); $rand = rand(0,3); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $header[$rand]); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); $page_content = curl_exec($ch); curl_close($ch); //usleep(50000);//休眠的级别为50毫秒 usleep(100000);//休眠的级别为50毫秒 echo $i; }
伪造成功,这是不是给“刷票”的朋友提供了很好的换IP的方案。
//伪造ip $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://test.com/curl/getClientIp.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.jb51.net/ "); //构造来路 curl_setopt($ch, CURLOPT_HEADER, 1); $out = curl_exec($ch); curl_close($ch);
魔高一尺道高一丈,有这种方式进行更换ip,也肯定有相应的对应的方式,可以思考一下。