, according to the city code to obtain the weather information the client obtains the data returned by the server and displays it on the page.
Services that are used
Here's a list of commonly used interfaces that we useIP City: "Http://ip.taobao.com/service/getIpInfo.php?ip=XXX"• View the code for the corresponding city: http://blog.csdn.net/anbowing/article/details/21936293• Access to weather interfaces,
Yahoo has reopened the weather API, and can only get 2000/IP per day without using OAuth
The Python code that uses OAuth to get the weather is as follows, using Requests_oauthlib for authentication
Use OAuth to get the weather for 2w times per hour, 10w times a day.
Please register a Yahoo app before use to get key
#
First, my app needs to get to the current location through the network. Here I found a JSON to get the local location information.http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js // get the city where the current network is located The information returned is:var remote_ip_info = {"ret": 1, "Start":-1, "End":-1, "Country": "\u4e2d\u56fd", "Province": "\u6cb3\u5357", "City": "\ u6d1b\u9633 "," District ":" "," ISP ":" "," type ":" "," de
#coding: Utf-8#version: 0.1#note: The API can query the air Quality index of a designated city, but the number of cities is limited, as of March 26, 2015, can only be found in 161 cities nationwide.Import Urllib.requestImport JSONImport CollectionsImport Urllib.parseurl = "Http://apistore.baidu.com/microservice/aqi?city="City = input ("Enter the cities you want to query:")City = Urllib.parse.quote (city)url = url + city #完整的URLresult = Urllib.request.
1, backstageif (Isset ($_get[' city ')) $_get[' city ']!= '){$url = ' http://m.weather.com.cn/data/';$city = (int) $_get[' city '];$json = file_get_contents ($url. $city. ') HTML ');Echo $json;Exit}
Gets the weather data for the http://m.weather.com.cn/data/and returns the JSON format data.
2. Front Desk
The return
This article shares a three line can get your designated city Weather information Php+google API implementation code, the need for friends can refer to.
The code is as follows
Copy Code
$xml = simplexml_load_file (' http://www.google.com/ig/api?weather= Changsha ');$information = $xml
A weather API
Http://wthrcdn.etouch.cn/WeatherApi?city=%E5%8C%97%E4%BA%ACYou can check the weather in Beijing. Behind the city= is the name of the city, which is Beijing.
The return format is Xml,gzip compression.
Get C # code for XML data
WebRequest request = WebRequest.Create ("Http://wthrcdn.etouch.cn/WeatherApi?city=%E5%8C%97%E4%BA%AC");
WebResponse respo
Baidu has gone through it and found some other methods to improve it.
Get weather URL: Weather.
Because it is written into the cookie record that day weather, all need to browse under the site.
JS
Code :
Copy code Code: var url = escape ("http://m.weather.com.cn/data/101210701.html ");
VaR cookie_info = "cookie_info ";
VaR date = new date ();
VaR hours = 24-dat
A few days ago there was a company to prepare for a second interview. The candidate is an iOS development intern, but has been doing android,ios just contact for one months, will not be very much, so decided to do a practical project to show the interviewer, more students gave a suggestion: can do a similar to the "Lazy Weather" project. are doing. I hope we can pass it well.The API interface for the
Php + simplexml iov api (2) weather forecast usage
Weather.html page weather. php xml processing page
Results as $ val) {echo''; # Compare the current city with the xml information table, and echo 'City:'. $ val-> currentCity. "weather_data-> dayPictureUrl} '>"; Echo 'time: '. $ data-> date .""; Echo 'temperature: '. $ val-> weather_data-> temperature .""; Echo
In Android development, the general app is to get server-side data to update the UI, from the server to obtain the data can be JSON, its data is smaller than XML, the analysis of the Chinese weather online access to the data, although it is no longer updated, but to learn is still possible, In order to facilitate my direct to the data through the TXT saved to the local, its data can be obtained through this
The API obtains weather forecasts and sends text messages to friends using the Apsara API.With the scheduled task, you can automatically send weather forecasts to yourself and your loved ones on a daily basis...
of shelter from the storm." " }, "Trav": { "BRF": "Suitable", "TXT": "There is precipitation, the temperature is appropriate, in the rain to play do not have a mood, you can not miss the opportunity yo!" But remember to carry rain gear. " }, "UV": { "BRF": "Weak", "TXT": "UV strength is weak, recommended to rub SPF in front of 12-15, pa+ sunscreen skin care products." " } } } ]}var url = "https://free-api.heweather.
Weather forecast information acquisition is obtained by using JSON, there are many resources on the net, source code. As the above involves a lot of weather information, including humidity, travel advice, etc., as well as a resource bundle that adds all the city codes. In order to practiced hand understand the principle of JS
Weather forecast information is obtained using JSON, there are a lot of resources on the Internet, source code. Because it involves a lot of weather information, including humidity, travel advice, etc., as well as a resource bundle that joins all city codes. In order to practiced hand understand the principle of JSON.
This article is from the "11996687" blog, please be sure to keep this source http://12006687.blog.51cto.com/11996687/1860846Baidu API free interface to get weather forecast
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.