解析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;

相关文章

Thinkphp框架开发移动端接口(1)

本文实例为大家分享了使用Thinkphp框架开发移动端接口代码,给原生APP提供api接口,具体内容如下 1. 使用TP框架时 放在common文件夹下文件名就叫function.php...

php简单防盗链验证实现方法 原创

这里分析了php的简单防盗链实现方法。分享飞大家供大家参考。具体如下: index.php页面如下: <html> <head> <meta http-...

php登录超时检测功能实例详解

php登录超时检测功能实例详解 前言: php登录超时问题,当用户超过一定时间没有操作页面时自动退出登录,原理是通过js进行访问判断的!代码如下(以thinkphp5.0版本为例) 1、...

PHP多线程之内部多线程实例分析

本文实例分析了PHP多线程之内部多线程用法。分享给大家供大家参考。具体如下: 复制代码 代码如下:<?php class Http_MultiRequest {  ...

php+ajax实现无刷新数据分页的办法

本文实例讲述了php+ajax实现无刷新分页的方法。分享给大家供大家参考。具体实现方法如下: index.php 文件,代码如下: <?php header("Con...