Open source free weather forecast Interface API and all regions nationwide code for National Weather

Source: Internet
Author: User
This site part of the article translated from English documents, but limited to my English proficiency limited, there is no way to understand the statement, the end of the article is generally given the source of the translation, good English parents can refer to the original version of English. Another part of the site is gradually improving the function ...
Please look forward to! If there is a problem, you can go to the message feedback!
Weather forecast has been a basic function of the major sites, the recent small series also want to make one on the site, a little bit, in the network search for a long time, finally found the open source free weather API and all regional code (National Weather Bureau), as follows:
Weather interface provided by the National Weather
-Get Provincial code: http://www.weather.com.cn/data/list3/city.xml?level=1
-
Get city code (e.g. Anhui is): http://www.weather.com.cn/data/list3/city22.xml?level=2
-
Get area code (e.g. Anqing is 2206): http://www.weather.com.cn/data/list3/city2206.xml?level=3
Get to Anhui province Anqing Wangjiang County code is 220607

-then add the Chinese code to request url:http://m.weather.com.cn/data/101220607.html to get local weather.

Header ("Content-type:text/html;charset=utf-8"); $weather = file_get_contents ("http://www.weather.com.cn/data/sk/ 101280601.html "); Echo $weather;

The above describes the open source free weather forecast Interface API and all regions nationwide code of the National Weather bureau to provide, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.