解析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数组对象与Json转换操作实例分析

本文实例讲述了PHP数组对象与Json转换操作。分享给大家供大家参考,具体如下:代码<?php //数组转对象 function arrayToObject($e){  ...

学习php设计模式 php实现命令模式(command)

学习php设计模式 php实现命令模式(command)

一、意图 将一个请求封装为一个对象,从而使用你可用不同的请求对客户进行参数化;对请求排队或记录请求日志,以及支持可撤消的操作。 可变的方面是:何时,怎样满足一个请求 命令模式是对命令的封...

wordpress之wp-settings.php

接上面开始wp-config.php,wp-settings.php这两个文件,wp-config.php故名恩意配置文件所以没什么可解释的。 wp-settings.php最上在的函数...

php实现压缩多个CSS与JS文件的方法

本文实例讲述了php实现压缩多个CSS与JS文件的方法。分享给大家供大家参考。具体实现方法如下: 1. 压缩css 复制代码 代码如下:<?php  &...

PHP 常用函数库和一些实用小技巧

文件读取函式 //文件读取函式 function PHP_Read($file_name) { $fd=fopen($file_name,r); while($bufline=fgets...