解析PHP跨站刷票的实现代码
前端之家收集整理的这篇文章主要介绍了
解析PHP跨站刷票的实现代码,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
废话不多说,上代码
<div class="codetitle"><a style="CURSOR: pointer" data="81852" class="copybut" id="copybut81852" onclick="doCopy('code81852')"> 代码如下:
<div class="codebody" id="code81852">
function curlrequest($url,$postfield,$referer='',$cookie='') {
////www.jb51.cc
$ip= 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,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,$ref,$cookies);
echo $result;