/**
*本代码仅仅适用于利用X-FORWARDED-FOR获取客户端IP的网站
*对于其他获取的无效
*/
echo ' ';//自动刷新,间隔时间5秒
function curlrequest($url, $postfield,$referer='',$cookie='') {
$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_REFERER, $referer); //构造来路
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-FORWARDED-FOR:'.$ip,
'CLIENT-IP:'.$ip,
'Accept: application/json, text/javascript, */*; q=0.01',
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With: XMLHttpRequest'));
$data = curl_exec($ch); //运行curl
curl_close($ch);
return $data;
}
$url='http://www.iqingyun.cn/user/getcode.html';
$ref='http://www.iqingyun.cn/?source=growup.com';
$cookies='';//cookies
$postfield=array(
'phone'=>'13312368637'
);
$postfield = http_build_query($postfield);
$result = curlrequest($url, $postfield,$ref,$cookies);
echo json_decode($result);
?>