ask*_*kon 29 php api yahoo weather
我正在创建一个应用程序(PHP),它从免费RSS源获取雅虎天气数据,并根据从RSS源检索到的数据将其与颜色十六进制相关联.我遇到的问题是找到一种方法来获取位置代码或WOEID,而无需手动执行.
只要您提供WOEID,Yahoos API就会发回RSS提要 - > http://weather.yahooapis.com/forecastrss?w=4097
这样做有道德的方法吗?我的初学者知识告诉我,我必须编写一个脚本,使用该术语搜索雅虎,并抓住第一个WOEID,但我会假设雅虎不希望脚本这样做,它似乎过于复杂......如果没有,有没有其他选择API会让我更容易吗?
谢谢!
小智 65
为什么不直接使用Yahoo! GeoPlanet服务将地点解析为WOEID?或者使用YQL服务通过它的表访问GeoPlanet?
http://where.yahooapis.com/v1/places.q('Barrie CA')?appid=[yourappidhere]
Run Code Online (Sandbox Code Playgroud)
要么
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22Barrie%20CA%22&format=xml
Run Code Online (Sandbox Code Playgroud)
无需刮痧.
干杯
G
(披露;我为Yahoo!工作,并且是WOEIDs和GeoPlanet背后的团队的一员)
我从以下网址获得了一些有用的信息:http: //developer.yahoo.com/geo/geoplanet/
和
http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html#api-countries
找到一个重要里程碑的WOEID:http: //where.yahooapis.com/v1/places.q('sydney%20opera%20house')?appid = [yourappidhere]
将WOEID解析到某个地方:http://where.yahooapis.com/v1/place/2507854?appid = [yourrappidhere]
找到特定地点的WOEID: http://where.yahooapis.com/v1/places.q('northfield%20mn%20usa')?appid = [yourappidhere]
获得一系列匹配给定地点的WOEID,最有可能排序:http://where.yahooapis.com/v1/places.q ('springfield'); start = 0; count = 5?appid = [yourappidhere ]
找到给定WOEID的父级(并返回详细记录):http://where.yahooapis.com/v1/place/638242/parent?select = long&appid = [yourappidhere]
以特定语言(存在的位置)返回给定WOEID的Placename:http: //where.yahooapis.com/v1/places.q('usa')?lang = fr&appid = [yourappidhere]
要以JSON格式获取地点的表示形式:http://where.yahooapis.com/v1/place/2487956?format = json&appid = [yourappidhere]
获取与特定WOEID相邻的地理列表:http://where.yahooapis.com/v1/place/12795711/neighbors?appid = [yourappidhere]