Php obtains the weather according to the interface

Source: Internet
Author: User
Php obtains weather information based on the interface and finds a common weather interface from the Internet:
Shanghai: "http://www.weather.com.cn/adat/cityinfo/101020100.html"
Return json substring:
{"Weatherinfo": {"city": "shanghai", "city_en": "shanghai", "date_y": "August March 4, 2014", "date ":"", "week": "Tuesday", "fchh": "11", "cityid": "101020100", "temp1": "11C ~ 6C "," temp2 ":" 10C ~ 5C "," temp3 ":" 8C ~ 4C "," temp4 ":" 8C ~ 6C "," temp5 ":" 8C ~ 6C "," temp6 ":" 10C ~ 5C "," tempF1 ":" 51.8F ~ 42.8F "," tempF2 ":" 50F ~ 41F "," tempF3 ":" 46.4F ~ 39.2F "," tempF4 ":" 46.4F ~ 42.8F "," tempF5 ":" 46.4F ~ 42.8F "," tempF6 ":" 50F ~ 41F "," weather1 ":" light rain to cloudy "," weat22. "light rain", "weather4": "light rain", "weather4": "light rain ", "weather5": "Light rain overcast", "weather6": "Cloudy", "img1": "7", "img2": "1", "img3 ": "1", "img4": "2", "img5": "7", "img6": "99", "img7": "7", "img8 ": "99", "img9": "7", "img10": "2", "img11": "1", "img12": "99", "img_single ": "7", "img_title1": "light rain", "img_title2": "multi cloud", "img_title3": "multi cloud", "img_title4": "Overcast", "img_title5 ": "Light Rain", "img_title6": "light rain", "img_title7": "light rain", "img_title8 ": "Light Rain", "img_title9": "light rain", "img_title10": "Overcast", "img_title11": "Cloudy", "img_title12": "Cloudy", "img_title_single ": "Light Rain", "wind1": "Northeast wind 3-4 to north wind 4-5", "wind2": "North Wind 4-5 to northeast wind 3-4", "wind3 ": "Dongfeng 4-5", "wind4": "Dongfeng to northeast wind 4-5", "wind5": "Northeast wind 3-4", "wind6": "Northeast wind to Dongfeng 3-4 ", "fx1": "Northeast wind", "fx2": "North Wind", "fl1": "3-4 to 4-5", "fl2": "4-5 to 3-4 ", "fl3": "4-5", "fl4": "4-5", "fl5": "3-4", "fl6": "3-4", "index ": "Cold", "index_d": "It is recommended that you wear thick coats and sweaters. Old and weak people should wear coats, coat and sweater. "," Index48 ":" cold "," index48_d ":" It is recommended that you wear thick coats and sweaters. Old and weak people should wear coats, coat and sweater. "," Index_uv ":" weakest "," index48_uv ":" weakest "," index_xc ":" not suitable "," index_tr ":" suitable "," index_co ": "more comfortable", "st1": "10", "st2": "3", "st3": "9", "st4": "2 ", "st5": "7", "st6": "2", "index_cl": "not suitable", "index_ls": "not suitable", "index_ag ": "easy-to-use "}}

The content format is correct and the information is complete, but no date is specified.
Problem:
① How do I obtain the weather information on the day and 7 days in Shanghai?
Or
② Can I use regular expressions to match the information of China Weather Network?
Url: http://www.weather.com.cn/weather/101020100.shtml

  • Today 3

    Light rain

    16C

    13C

    Breeze

  • Tomorrow 4

    Light rain

    23C

    15C

    Breeze

  • Day 5

    Thundershower

    21C

    13C

    Breeze

  • Monday 6

    Moderate rain to light rain

    15C

    10C

    Grade 3-4

  • Tuesday 7

    Moderate rain

    13C

    8C

    Grade 3-4

  • Wednes8

    Moderate rain to light rain

    13C

    9C

    Breeze

  • Thursday 9

    Overcast

    14C

    9C

    Breeze


Match the content I commented out, but this method is troublesome and inefficient.
Help...


Reply to discussion (solution)

A real-time interface is found:
Http://weatherapi.market.xiaomi.com/wtr-v2/weather? CityId = 101020100

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.