解析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随机生成数字字母组合的方法。分享给大家供大家参考。具体如下: 直接上代码: 复制代码 代码如下:function getRandomString($len, $cha...

php判断表是否存在的方法

本文实例讲述了php判断表是否存在的方法。分享给大家供大家参考。具体如下: <?php //方法一 mysql_connect('localhost','root'...

PHP学习笔记(二) 了解PHP的基本语法以及目录结构

PHP学习笔记(二) 了解PHP的基本语法以及目录结构

通过这节课, 1.了解AppServ的目录结构 2.我们可以了解PHP的基本语法结构 1 我的AppServ安装目录是E盘: ①运用命令行的方式去操作apache服务器 apache服...

phpwind中的数据库操作类

<?php /*来源:phpwind.net*/ Class DB { var $query_num = 0; function&...

php 获取一个月第一天与最后一天的代码

复制代码 代码如下:function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastda...