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

网络编程 2021-07-05 09:49www.168986.cn编程入门
本篇文章是对PHP跨站刷票的实现代码进行了详细的分析介绍,需要的朋友参考下
废话不多说,上代码
代码如下:

function curlrequest($url, $postfield,$referer='',$cookie='') {
 //https://.jb51.
  $ip= rand(100, 244).'.'.rand(100, 244).'.'.rand(100, 244).'.'.rand(100, 244);
  $ch = curl_init();
  curl_set($ch, CURLOPT_URL, $url);
  curl_set($ch, CURLOPT_HEADER, 0);
  curl_set($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_set($ch, CURLOPT_POST, 1);
  curl_set($ch, CURLOPT_POSTFIELDS, $postfield);
  curl_set($ch, CURLOPT_COOKIE, $cookie);
  curl_set($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.$ip, 'CLIENT-IP:'.$ip)); //构造IP
 curl_set($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;

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by