The interface is as follows:
Http://wthrcdn.etouch.cn/weather_mini?city= Beijing
Direct input from the browser to get the return value
But I used file_get_contents (), fopen (), and curl get no return value.
Beginners, do not know whether the use of their own problems.
Reply to discussion (solution)
$url = ' Http://wthrcdn.etouch.cn/weather_mini?city=%E5%8C%97%E4%BA%AC '; Echo gzdecode (file_get_contents ($url));
{"desc": "OK", "status": +, "data": {"Wendu": "8", "Ganmao": "Day and night temperature difference is very big, prone to colds, please pay attention to appropriate increase or decrease clothing, strengthen self-protection to avoid colds." "," forecast ": [{" Fengxiang ":" North Wind "," Fengli ":" 3-4 Levels "," High ":" 9 ℃ "," type ":" Sunny "," Low ":" Cryogenic -4℃ "," date ":" 16th Tuesday "},{" Fengxiang ":" No continuous Wind Direction "," Fengli ":" Breeze Level "," High ":" Hot 9 ℃ "," type ":" Sunny "," Low ":" Cryogenic -2℃ "," date ":" 17th Wednesday "},{" Fengxiang ":" North Wind "," Fengli ":" 3-4 "," High ":" 9 ℃ "," type ":" Sunny "," Low ":" Cryogenic -2℃ "," date ":" 18th Thursday "},{" Fengxiang ":" North Wind "," Fengli ":" 3-4 Levels "," high ":" High temperature 7 ℃ "," type ":" Cloudy "," Low ":" -2℃ "," date ":" 19th Friday "},{" Fengxiang ":" No continuous Wind Direction "," Fengli ":" Breeze Level "," High ":" Hot 3 ℃ "," type ":" Clear "," Low ":" Lo -5℃ "," date ":" 20th Saturday "}]," Yesterday ": {" FL ":" Level 3-4 "," FX ":" North Wind "," High ":" Hot 5 ℃ "," type ":" Clear "," Low ":" Lo -4℃ "," Date ": Monday, 15th"}, "AQI": "$", "City": "Beijing"}
Thank you Moderator!!!