PHP gets the weather based on the interface

Source: Internet
Author: User
Find a popular common weather interface from the Internet:
Shanghai: "Http://www.weather.com.cn/adat/cityinfo/101020100.html"
Returns the JSON substring:
{"Weatherinfo": {"City": "Shanghai", "city_en": "Shanghai", "date_y": "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 Turns Cloudy "," Weather2 ":" Cloudy "," Weather3 ":" Drizzle "," weather4 ":" Drizzle "," weather5 ":" Drizzle Turn yin "," weather6 ":" Cloudy "," IMG1 ":" 7 "," Img2 ":" 1 "," IMG3 ":" 1 "," IMG4 ":" 2 "," Img5 ":" 7 "," Img6 ":" The "," Img7 ":" 7 "," Img8 ": "Img9": "7", "Img10": "2", "Img11": "1", "Img12": "", "Img_single": "7", "Img_title1": "Drizzle", "img_title2": "Cloudy", "img _title3 ":" Cloudy "," img_title4 ":" Yin "," img_title5 ":" Drizzle "," img_title6 ":" Drizzle "," img_title7 ":" Drizzle "," img_title8 ":" Drizzle "," img_ Title9 ":" Light Rain "," Img_title10 ":" Yin "," img_title11 ":" Cloudy "," img_title12 ":" Cloudy "," img_title_single ":" Drizzle "," wind1 ":" Northeast 3-4 to North Wind 4-5 "," Wind2 ":" North wind 4-5 turn northeast 3-4 level "," Wind3 ":" Dongfeng 4-5 Class "," Wind4 ":" Dongfeng to the northeast of 4-5 "," Wind5 ":" Northeast of 3-4 "," Wind6 ":" Northeast Wind 3-4 "," fx1 ":" Northeast "," FX2 ":"North Wind "," FL1 ":" 3-4 level to 4-5 levels "," FL2 ":" 4-5 level to 3-4 level "," FL3 ":" 4-5 Level "," Fl4 ":" 4-5 "," FL5 ":" 3-4 "," fl6 ":" 3-4 "," index ":" Cooler "," Index_d ":" suggest a thick coat and sweater and other clothing. The frail and infirm are advised to coat, coat and cardigan. "," index48 ":" Colder "," index48_d ":" suggest a thick coat and sweater and other clothing. " The frail and infirm are advised to coat, coat and cardigan. "Index_uv": "Weakest", "INDEX48_UV": "Weakest", "index_xc": "Unsuitable", "index_tr": "Fit", "Index_co": "More Comfortable", "st1": "Ten", "St2": "3", "ST3 ":" 9 "," St4 ":" 2 "," ST5 ":" 7 "," St6 ":" 2 "," INDEX_CL ":" Inappropriate "," Index_ls ":" Not Appropriate "," Index_ag ":" Easy Hair "}}

The content format is correct, the information is more complete, but there is no date to obtain the way.
Problem:
① How to get weather information for the day and 7 days in Shanghai?
Or
② can use regular to match the information of Chinese weather net?
Url:http://www.weather.com.cn/weather/101020100.shtml
 
 
  • Today

    3rd

    Rain

    - C

    - C

    Breeze

  • Tomorrow

    4th

    Rain

    at C

    the C

    Breeze

  • Acquired

    5th

    Thunder storm

    + C

    - C

    Breeze

  • Monday

    6th

    Moderate rain turn to drizzle

    the C

    Ten C

    Level 3-4

  • Tuesday

    7th

    Moderate Rain

    - C

    8 C

    Level 3-4

  • Wednesday

    8th

    Moderate rain turn to drizzle

    - C

    9 C

    Breeze

  • Thursday

    9th

    Yin

    - C

    9 C

    Breeze


It's OK to match the contents of my comments, but this method is a bit cumbersome and inefficient.
Help...


Reply to discussion (solution)

A real-time interface was 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.