解析PHP跨站刷票的实现代码_php教程-查字典教程网
解析PHP跨站刷票的实现代码
解析PHP跨站刷票的实现代码
发布时间:2016-12-29 来源:查字典编辑
摘要:废话不多说,上代码复制代码代码如下:functioncurlrequest($url,$postfield,$referer='',$coo...

废话不多说,上代码

复制代码 代码如下:

function curlrequest($url, $postfield,$referer='',$cookie='') {

//http://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教程学习
    编程开发子分类