The interface for obtaining parameters is as follows:
Http://wthrcdn.etouch.cn/weather_mini? City = Beijing
You can directly input data in a browser to obtain the returned value.
However, when file_get_contents (), fopen (), and curl are used, the returned values cannot be obtained.
I am a beginner. I don't know if I am using it myself.
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": 1000, "data": {"wendu": "8", "ganmao": "large temperature difference between day and night, easy to catch a cold, please pay attention to appropriate increase or decrease clothes, strengthen self protection to avoid catching a cold. "," Forecast ": [{" fengxiang ":" Beifeng "," fengli ":" Grade 3-4 "," high ":" high temperature 9 ℃ "," type ": "Clear", "low": "low temperature-4 ℃", "date": "Tuesday 16" },{ "fengxiang": "no sustained wind direction ", "fengli": "breeze level", "high": "high temperature 9 ℃", "type": "Clear", "low": "low temperature-2 ℃ ", "date": "Wednesday 17" },{ "fengxiang": "Beifeng", "fengli": "Grade 3-4", "high": "high temperature 9 ℃ ", "type": "Clear", "low": "low temperature-2 ℃", "date": "Thursday 18" },{ "fengxiang": "North Wind ", "fengli": "Grade 3-4", "high": "high temperature 7 ℃", "type": "multi cloud", "low": "low temperature-2 ℃ ", "date": "Friday 19" },{ "fengxiang": "no sustained wind direction", "fengli": "breeze level", "high ": "High temperature 3 ℃", "type": "Clear", "low": "low temperature-5 ℃", "date": "Saturday 20"}], "yesterday": {"fl": "Grade 3-4", "fx": "North Wind", "high": "high temperature 5 ℃", "type": "Clear ", "low": "low temperature-4 ℃", "date": "Monday 15"}, "aqi": "41", "city": "Beijing "}}
Thank you !!!!