首页 >php教程 >PHP源码 >PHP跨站刷票代码

PHP跨站刷票代码

PHP中文网
PHP中文网原创
2016-05-25 17:08:251124浏览

话不多说,直接上代码

function curlrequest($url, $postfield,$referer='',$cookie='') {
//http://blog.ddian.cn/?post=855
 $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;

                   

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn