当前位置: 移动技术网 > IT编程>开发语言>PHP > 解析PHP跨站刷票的实现代码

解析PHP跨站刷票的实现代码

2019年05月25日  | 移动技术网IT编程  | 我要评论
废话不多说,上代码
复制代码 代码如下:

function curlrequest($url, $postfield,$referer='',$cookie='') {
 ////www.jb51.net
  $ip= rand(100, 244).'.'.rand(100, 244).'.'.rand(100, 244).'.'.rand(100, 244);
  $ch = curl_init();
  curl_setopt($ch, curlopt_url, $url);
  curl_setopt($ch, curlopt_header, 0);
  curl_setopt($ch, curlopt_returntransfer, 1);
  curl_setopt($ch, curlopt_post, 1);
  curl_setopt($ch, curlopt_postfields, $postfield);
  curl_setopt($ch, curlopt_cookie, $cookie);
  curl_setopt($ch, curlopt_httpheader, array('x-forwarded-for:'.$ip, 'client-ip:'.$ip)); //构造ip
 curl_setopt($ch, curlopt_referer, $referer); //构造来路
  $data = curl_exec($ch); //运行curl
  curl_close($ch);
  return $data;
 }
 $url='http://xxxxx/vote.php';
 $ref='http://xxxxx/index.php';
 $cookies='';//构造你的cookies
 $postfield=array(
  'information_id'=>201204211839164950
 );
 $postfield = http_build_query($postfield);
 $result = curlrequest($url, $postfield,$ref,$cookies);
 echo $result;

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网