PHP跨站刷票的解决办法
内容摘要
这篇文章主要为大家详细介绍了PHP跨站刷票的简单示例,具有一定的参考价值,可以用来参考一下。
感兴趣的小伙伴,下面一起跟随php教程的小玲来看看吧!废话不多说,上代码
代码如下:
感兴趣的小伙伴,下面一起跟随php教程的小玲来看看吧!废话不多说,上代码
代码如下:
文章正文
这篇文章主要为大家详细介绍了PHP跨站刷票的简单示例,具有一定的参考价值,可以用来参考一下。
感兴趣的小伙伴,下面一起跟随php教程的小玲来看看吧!
废话不多说,上代码代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <code> function curlrequest( $url , $postfield , $referer = '' , $cookie = '' ) { //https://www.idcnote.com $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 ; </code> |
注:关于PHP跨站刷票的简单示例的内容就先介绍到这里,更多相关文章的可以留意
代码注释