Obtain interface parameters

Source: Internet
Author: User
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 !!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.