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

yipeiwu_com5年前PHP代码库
废话不多说,上代码
复制代码 代码如下:

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;

相关文章

php获取从百度、谷歌等搜索引擎进入网站关键词的方法

本文实例讲述了php获取从百度、谷歌等搜索引擎进入网站关键词的方法。分享给大家供大家参考。具体实现方法如下: <?php function search_word_fr...

一些PHP写的小东西

一些小东西有时候可能用得上!  1.得到客户端IP地址  function getip(){      &...

php除数取整示例

示例: 复制代码 代码如下: $father = intval(floor($evalue/500))*500;...

php 记录进行累加并显示总时长为秒的结果

现在有一个mysql数据库的test表里有一个duration字段,里面有三条记录: 00:22:32 13:42:21 134:42:21 表示的是时长,但是,保存类型是文本。 现在要...

PHP实现将浏览历史页面网址保存到cookie的方法

本文实例讲述了PHP实现将浏览历史页面网址保存到cookie的方法。分享给大家供大家参考。具体如下: 将浏览历史页面网址保存到cookie,大致的思路如下面的代码,与实际应用有些差别。...