來源:http://www.jb51.net/article/31694.htmphp
curl 它不但能夠模仿用戶登陸,還能夠模仿用戶IP地址哦,爲僞造IP來源,本實例僅供參考哦html
//僞造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的方案。curl
//僞造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,也確定有相應的對應的方式,能夠思考一下。url