如果用浏览器访问一个网址:
http://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&pcevaname=pc2&da_par=direct&from=webmap&qt=s&from=webmap&c=187&pl_data_type=cater&pl_sub_type=&pl_price_section=0%2C%2B&pl_sort_type=data_type&pl_sort_rule=0&pl_discount2_section=0%2C%2B&pl_groupon_section=0%2C%2B&pl_cater_book_pc_section=0%2C%2B&pl_ticket_book_flag_section=0%2C%2B&pl_movie_book_section=0%2C%2B&pl_business_type=cater&pl_business_id=&pl_activity_gwj_section=0%2C%2B&wd=%E9%85%92%E5%90%A7&pn=3&db=0&wd2=&sug=0&da_src=pcmappg.poi.page&on_gel=1&src=7&gr=3&b=(12583968.24,2545864.04;12616096.24,2573032.04)&l=13&addr=0&nn=30&tn=B_NORMAL_MAP&ie=utf-8&t=1430101051225
则数据显示正常。。。
但是如果用php代码去获取返回的json数据,数据就不对了,比如我们只关注addr这个值,会发现大多数是空的(其他值也是错乱)
php code
$url = 'http://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&pcevaname=pc2&da_par=direct&from=webmap&qt=s&from=webmap&c=187&pl_data_type=cater&pl_sub_type=&pl_price_section=0%2C%2B&pl_sort_type=data_type&pl_sort_rule=0&pl_discount2_section=0%2C%2B&pl_groupon_section=0%2C%2B&pl_cater_book_pc_section=0%2C%2B&pl_ticket_book_flag_section=0%2C%2B&pl_movie_book_section=0%2C%2B&pl_business_type=cater&pl_business_id=&pl_activity_gwj_section=0%2C%2B&wd=%E9%85%92%E5%90%A7&pn=3&db=0&wd2=&sug=0&da_src=pcmappg.poi.page&on_gel=1&src=7&gr=3&b=(12583968.24,2545864.04;12616096.24,2573032.04)&l=13&addr=0&nn=30&tn=B_NORMAL_MAP&ie=utf-8&t=1430101051225'; $json = file_get_contents($url); $data = json_decode($json); //echo $count; var_dump($data);
这是为什么?
更奇怪的是,刚开始采集时,是可以的,采集着采集着就不行了。。。
所以我的问题是:这个file_get_content和直接访问,对服务端来说有什么区别?服务端靠什么区别的??