Baidu weather interface is very simple

Source: Internet
Author: User
Note the area to Transcode
Baidu AK Application Address: Http://lbsyun.baidu.com/apiconsole/key
    1. $city = "Jiaxing";
    2. $content = file_get_contents ("http://api.map.baidu.com/telematics/v3/weather?location=%e5%98%89%e5%85%b4& Output=json&ak=5slgyqgdenn7sy7pw29iuvrz ");
    3. Print_r (Json_decode ($content));
Copy Code
  1. {
  2. error:0,
  3. Status: "Success",
  4. Date: "2014-04-18",
  5. Results: [
  6. {
  7. CurrentCity: "Jiaxing",
  8. Weather_data: [
  9. {
  10. Date: "Today (Wednesday)",
  11. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  12. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  13. Weather: "Cloudy",
  14. Wind: "Breeze",
  15. Temperature: "23 ℃"
  16. },
  17. {
  18. Date: "Tomorrow (Thursday)",
  19. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/leizhenyu.png",
  20. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/zhongyu.png",
  21. Weather: "Cloudy and cloudy",
  22. Wind: "Breeze",
  23. Temperature: "29~22℃"
  24. },
  25. {
  26. Date: "The Day After Tomorrow (Friday)",
  27. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/yin.png",
  28. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  29. Weather: "Overcast to Cloudy",
  30. Wind: "Breeze",
  31. Temperature: "31~23℃"
  32. },
  33. {
  34. Date: "The Great Day after (Saturday)",
  35. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  36. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  37. Weather: "Cloudy",
  38. Wind: "Breeze",
  39. Temperature: "31~24℃"
  40. }
  41. ]
  42. },
  43. {
  44. CurrentCity: "Hefei",
  45. Weather_data: [
  46. {
  47. Date: "Today (Wednesday)",
  48. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  49. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  50. Weather: "Cloudy",
  51. Wind: "Dongfeng level 3-4",
  52. Temperature: "27 ℃"
  53. },
  54. {
  55. Date: "Tomorrow (Thursday)",
  56. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  57. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  58. Weather: "Cloudy",
  59. Wind: "3-4 levels Northeast",
  60. Temperature: "35~27℃"
  61. },
  62. {
  63. Date: "The Day After Tomorrow (Friday)",
  64. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  65. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  66. Weather: "Cloudy",
  67. Wind: "Southerly",
  68. Temperature: "35~27℃"
  69. },
  70. {
  71. Date: "The Great Day after (Saturday)",
  72. Daypictureurl: "Http://api.map.baidu.com/images/weather/day/duoyun.png",
  73. Nightpictureurl: "Http://api.map.baidu.com/images/weather/night/duoyun.png",
  74. Weather: "Cloudy",
  75. Wind: "Dongfeng",
  76. Temperature: "34~27℃"
  77. }
  78. ]
  79. }
  80. ]
  81. }
Copy Code
  • 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.