Using China weather forecast interface to realize simple weather forecast

Source: Internet
Author: User

  This article mainly introduces the use of China weather forecast interface to achieve a simple weather forecast example, we refer to the use of the bar

  Code as follows: <?php header ("Content-type:text/html;charset=utf-8"); $weather = file_get_contents (""); echo $weather?>      code as follows: <html> <head> <meta http-equiv= "Content-type" content= " TEXT/HTML;CHARSET=GBK "/> <style type= text/css" > all span {font:bold 30px/50px "Arial"; color:red > <title> Weather </title> </head> <body> <div class= "All" > This is: <span class= "Place" > City </span&gt, the temperature is <span class= "temp" > Temperature </span> Wind Direction: <span class= "Wind" > Direction </span&gt Wind: <span class= "Windpower" > Wind </span> </div> <script type= "Text/javascript" src= "HTTP://" Jquery.js "></script> <script type=" Text/javascript "> $ (function () {$.ajax ({//Requested address URL:" http:// ",///////////////////////////////////////////////////////Success:function '); Get element var $place with jquery-1.8.2 = $ ('. Place '), $temp = $ (". Temp"), $wind = $ (". Wind"), $windPower = $ (". Windpower"); Place the returned data in the appropriate location $place. html (od["Weatherinfo"] ["City"]); $temp. HTML (od["Weatherinfo"] ["temp"] + "°"); $wind. HTML (od["Weatherinfo"] ["WD"]); $windPower. HTML (od["Weatherinfo"] ["WS"]); } }); }) </script> </body> </html>  
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.