function echo_var_dump($obj){
echo "
";
echo var_dump($obj);
echo "
";
}
function GetCurl($url) {
//curl 伪造useragent
$useragent = array(
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)',
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)',
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1',
'Opera/9.27 (Windows NT 5.2; U; zh-cn)',
'Opera/8.0 (Macintosh; PPC Mac OS X; U; en)',
'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 ',
'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13'
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $url);
// 设置iP和useragent
curl_setopt($curl, CURLOPT_REFERER, "http://h5.eqxiu.com/s/Rwg9jFlv");
curl_setopt($curl, CURLOPT_USERAGENT, array_rand($useragent));
$resp = curl_exec($curl);
curl_close($curl);
return $resp;
}
$url = "http://s1.eqxiu.com/eqs/page/119805007?code=Rwg9jFlv&time=1523150497000";
$page_data = GetCurl($url);
$page_arr = json_decode($page_data, true);
echo_var_dump($page_arr);