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

yipeiwu_com6年前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,我觉得还是看手册的好。花了几天时间看了...

php创建多级目录代码

function createFolder($path) {    if (!file_exists($path))  &nb...

PHP如何利用P3P实现跨域

有别于JS跨域、IFRAME跨域等的常用处理办法,还可以利用P3P来实现跨域。P3P是什么P3P(Platform for Privacy Preferences)是W3C公布的一项隐私...

php通过ksort()函数给关联数组按照键排序的方法

本文实例讲述了php通过ksort()函数给关联数组按照键排序的方法。分享给大家供大家参考。具体分析如下: php通过ksort()函数给关联数组按照键排序,ksort函数按照关联数组的...

php判断上传的Excel文件中是否有图片及PHPExcel库认识

需要借助PHPExcel这个库复制代码 代码如下:$excelPath = 'Test.xls'; $objReader = PHPExcel_IOFactory::createRead...