解析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中将网址转换为超链接的函数

复制代码 代码如下: function showtext($text){ $search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|',...

php addslashes 利用递归实现使用反斜线引用字符串

实现代码:复制代码 代码如下:<?phpfunction addslashes_deep($value){//史上最经典的递归,一行搞定return is_array($value...

php绘制一条直线的方法

本文实例讲述了php绘制一条直线的方法。分享给大家供大家参考。具体实现方法如下: 复制代码 代码如下:<?php //1、创建画布 $im = imagecreatetru...

黑夜路人出的几道php笔试题

一、基础题 1. 写出如下程序的输出结果 复制代码 代码如下: <? $str1 = null; $str2 = false; echo $str1==$str2 ? '相等' :...

php判断表是否存在的方法

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