php curl伪造来源ip和来路refer实例代码1:

 //随机IP
function Rand_IP(){ $ip2id= round(rand(600000, 2550000) / 10000); //第一种方法,直接生成
$ip3id= round(rand(600000, 2550000) / 10000);
$ip4id= round(rand(600000, 2550000) / 10000);
//下面是第二种方法,在以下数据中随机抽取
$arr_1 = array("218","218","66","66","218","218","60","60","202","204","66","66","66","59","61","60","222","221","66","59","60","60","66","218","218","62","63","64","66","66","122","211");
$randarr= mt_rand(0,count($arr_1)-1);
$ip1id = $arr_1[$randarr];
return $ip1id.".".$ip2id.".".$ip3id.".".$ip4id;
} //抓取页面内容
function Curl($url){
$ch2 = curl_init();
$user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";//模拟windows用户正常访问
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch2, CURLOPT_TIMEOUT, 10);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.Rand_IP(), 'CLIENT-IP:'.Rand_IP()));
//追踪返回302状态码,继续抓取
curl_setopt($ch2, CURLOPT_HEADER, true);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch2, CURLOPT_NOBODY, false);
curl_setopt($ch2, CURLOPT_REFERER, 'http://www.baidu.com/');//模拟来路
curl_setopt($ch2, CURLOPT_USERAGENT, $user_agent);
$temp = curl_exec($ch2);
curl_close($ch2);
return $temp;
}

php curl伪造来源ip和来路refer实例代码2:

 <?php

 $postData = array(
"user" => "root",
"pwd" => "123456"
); $headerIp = array(
'CLIENT-IP:88.88.88.88',
'X-FORWARDED-FOR:88.88.88.88',
); $refer = 'http://www.nidagelail.com'; $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/phpdemo/test.php'); //伪造来源refer
curl_setopt($ch, CURLOPT_REFERER, $refer);
//伪造来源ip
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerIp); //提交post传参
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
//...各种curl属性参数设置
$out_put = curl_exec($ch);
curl_close($ch);
var_dump($out_put);

最新文章

  1. IOS开发基础知识--碎片22
  2. BIOS设置开机密码
  3. DOM节点访问
  4. poj2420A Star not a Tree?(模拟退火)
  5. 2016 ACM/ICPC Asia Regional Shenyang Online 1003/HDU 5894 数学/组合数/逆元
  6. 每个PHP开发者都应该看的书
  7. jquery mobile跳转到指定id时怎样传递参数
  8. The breakpoint will not currently be hit. vs2005断点不被命中
  9. System.Net网络编程--AuthenticationManager和IAuthenticationModule
  10. kettle 连接 mysql 出错 Driver class &#39;org.gjt.mm.mysql.Driver&#39; could not be found, make sure the ……
  11. USB学习小记-HID类键盘的报告描述符的理解
  12. Java知多少(4)J2SE、J2EE、J2ME的区别
  13. 完美的拥抱GitHub
  14. Binary Trees
  15. JavaScript面向对象轻松入门之封装(demo by ES5、ES6、TypeScript)
  16. 慕课网视频破解付费分享-前端开发-Python等
  17. UEditor1.4.3.3整合Spring MVC和七牛
  18. Office Add-in 架构和入门
  19. js动态生成二维码
  20. GIT 查看 删除 添加远程库

热门文章

  1. secureCRT启动xmanager图形化工具
  2. 连接ACCESS
  3. svn出错:directory &#39;xxxx&#39; is out of date
  4. MySQL使用全文索引(fulltext index)---高性能
  5. Android轮播图Banner的实现
  6. 51nod1079
  7. 51nod1709复杂度分析
  8. 传递数据后创建后台service来处理事件!
  9. 关于apicloud ios自定义模块引用第三方framework not found for architecture armv7
  10. AE项目打包