解析PHP跨站刷票的实现代码
程序员文章站
2022-06-15 09:38:22
废话不多说,上代码复制代码 代码如下:function curlrequest($url, $postfield,$referer='',$cookie='') { &nb...
废话不多说,上代码
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;
复制代码 代码如下:
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错误级别的设置方法
下一篇: 三国演义马超是怎么死的?马超之死大揭秘!