<?php
set_time_limit(0);
error_reporting(1024);
ob_start();
header("Content-Type:text/html;charset=GBK");
header('Cache-Control:no-cache,must-revalidate');
header('Pragma:no-cache');
ini_set('date.timezone','Asia/Shanghai');$url = 'http://i.sporttery.cn/odds_calculator/get_odds?i_format=json&poolcode[]=hhad&poolcode[]=had';
$content = getCurlData($url);
var_dump($content);function getCurlData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host:info.sporttery.cn",
"Cache-Control: max-age=0",
"Accept-Encoding: gzip, deflate",
"Accept:*/*",
"Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection: keep-alive",
"Cookie:COLLCK=3282378182; Hm_lvt_860f3361e3ed9c994816101d37900758=1505871680; COLLCK=4081554587; Hm_lpvt_860f3361e3ed9c994816101d37900758=1505889209",
"Upgrade-Insecure-Requests: 1",
));
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_MAXREDIRS,20); $cdata = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($info);
/*
if($info['http_code']==302){
getCurlData($url);
}
*/
curl_close($ch); return $cdata;
}ob_end_flush();
exit;
?>
set_time_limit(0);
error_reporting(1024);
ob_start();
header("Content-Type:text/html;charset=GBK");
header('Cache-Control:no-cache,must-revalidate');
header('Pragma:no-cache');
ini_set('date.timezone','Asia/Shanghai');$url = 'http://i.sporttery.cn/odds_calculator/get_odds?i_format=json&poolcode[]=hhad&poolcode[]=had';
$content = getCurlData($url);
var_dump($content);function getCurlData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host:info.sporttery.cn",
"Cache-Control: max-age=0",
"Accept-Encoding: gzip, deflate",
"Accept:*/*",
"Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection: keep-alive",
"Cookie:COLLCK=3282378182; Hm_lvt_860f3361e3ed9c994816101d37900758=1505871680; COLLCK=4081554587; Hm_lpvt_860f3361e3ed9c994816101d37900758=1505889209",
"Upgrade-Insecure-Requests: 1",
));
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_MAXREDIRS,20); $cdata = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($info);
/*
if($info['http_code']==302){
getCurlData($url);
}
*/
curl_close($ch); return $cdata;
}ob_end_flush();
exit;
?>
set_time_limit(0);
error_reporting(1024);
ob_start();
header("Content-Type:text/html;charset=utf-8");
//header('Cache-Control:no-cache,must-revalidate');
header('Pragma:no-cache');
ini_set('date.timezone','Asia/Shanghai');$url = 'http://i.sporttery.cn/odds_calculator/get_odds?i_format=json&poolcode[]=hhad&poolcode[]=had';
$content = getCurlData($url);
var_dump($content);function getCurlData($url){
$cookie = tempnam("/tmp", "cookie");
//先获取 cookie
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE); $cdata = curl_exec($ch);
$info = curl_getinfo($ch);
var_dump($info);
/*
if($info['http_code']==302){
getCurlData($url);
}
*/
curl_close($ch); return $cdata;
}ob_end_flush();
exit;