您的位置:首页 > 编程语言 > PHP开发

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

2018-10-12 13:58 519 查看
废话不多说,上代码

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;

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: