Created
March 28, 2016 10:28
-
-
Save maicong/a4e965b4c869fa7da387 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* php -f tp.php | |
*/ | |
function curl_post($url, $param = '', $cookie = ''){ | |
$host = parse_url($url); | |
$site = $host['scheme']."://".$host['host']; | |
$rand_ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' . mt_rand(20, 51) . '.0.' . mt_rand(1050, 3588) . '.' . mt_rand(10, 99) . ' Safari/537.36'; | |
$rand_ip = mt_rand(1, 255) . '.' . mt_rand(1, 255) . '.' . mt_rand(1, 255) . '.' . mt_rand(1, 255); | |
$header = [ | |
'Cookie:'.$cookie, | |
'Host:'.$host['host'], | |
'Origin:http://'.$host['host'], | |
'X-FORWARDED-FOR:'.$rand_ip, | |
'X-FORWARDED:'.$rand_ip, | |
'X-CLUSTER-CLIENT-IP:'.$rand_ip, | |
'CLIENT-IP:'.$rand_ip, | |
'FORWARDED-FOR:'.$rand_ip, | |
'FORWARDED:'.$rand_ip, | |
'REMOTE-ADDR:'.$rand_ip, | |
'X-FORWARDED-HOST:'.$host['host'], | |
'X-FORWARDED-SERVER:'.$host['host'], | |
'X-Requested-With: XMLHttpRequest' | |
]; | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 30); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_REFERER, $site); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); | |
curl_setopt($ch, CURLOPT_USERAGENT, $rand_ua); | |
curl_setopt($ch, CURLOPT_HTTPHEADER , $header); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
return $response; | |
} | |
$head = get_headers('http://mark.1ping.com/index.php/home/index/detail/id/9.html?from=timeline&isappinstalled=1',true); | |
$cookie = $head['Set-Cookie']; | |
$go = curl_post('http://mark.1ping.com/index.php/home/index/vote.html', 'id=9', $cookie); | |
print_r(json_decode($go)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment