Google API 獲取天氣預報資訊

2021-05-28 13:57:09 字數 3803 閱讀 8395

**: 

要獲得天氣預報資訊可用利用google提供的藉口,   

城市名稱(拼音)   

它將返回乙個用xml封裝的天氣資訊。  

示例:shanghai

返回:<?

xml version="1.0" 

?> -

<

xml_api_reply

version

="1"

>

-<

weather

module_id

="0"

tab_id

="0"

mobile_row

="0"

mobile_zipped

="1"

row="0"

section

="0"

>

-<

forecast_information

>

<

city

data

="shanghai, shanghai"

/>

<

postal_code

data

="shanghai"

/>

<

latitude_e6

data=""

/>

<

longitude_e6

data=""

/>

<

forecast_date

data

="2010-08-30"

/>

<

current_date_time

data

="2010-08-30 17:00:00 +0000"

/>

<

unit_system

data

="si"

/>

forecast_information

>

-<

current_conditions

>

<

condition

data

="多雲"

/>

<

temp_f

data

="84"

/>

<

temp_c

data

="29"

/>

<

humidity

data

="濕度: 62%"

/>

<

icon

data

="/ig/images/weather/cn_cloudy.gif"

/>

<

wind_condition

data

="風向: 東北、風速:7 公尺/秒"

/>

current_conditions

>

-<

forecast_conditions

>

<

day_of_week

data

="周一"

/>

<

lowdata

="27"

/>

<

high

data

="33"

/>

<

icon

data

="/ig/images/weather/chance_of_rain.gif"

/>

<

condition

data

="可能有雨"

/>

forecast_conditions

>

-<

forecast_conditions

>

<

day_of_week

data

="周二"

/>

<

lowdata

="26"

/>

<

high

data

="34"

/>

<

icon

data

="/ig/images/weather/chance_of_storm.gif"

/>

<

condition

data

="可能有暴風雨"

/>

forecast_conditions

>

-<

forecast_conditions

>

<

day_of_week

data

="週三"

/>

<

lowdata

="26"

/>

<

high

data

="33"

/>

<

icon

data

="/ig/images/weather/chance_of_storm.gif"

/>

<

condition

data

="可能有暴風雨"

/>

forecast_conditions

>

-<

forecast_conditions

>

<

day_of_week

data

="周四"

/>

<

lowdata

="26"

/>

<

high

data

="34"

/>

<

icon

data

="/ig/images/weather/chance_of_rain.gif"

/>

<

condition

data

="可能有雨"

/>

forecast_conditions

>

weather

>

xml_api_reply

>

chncms

Google API 獲取天氣預報資訊

要獲得天氣預報資訊可用利用google提供的藉口,城市名稱 拼音 它將返回乙個用xml封裝的天氣資訊。示例 shanghai 返回 xml version 1.0 xml api reply version 1 weather module id 0 tab id 0 mobile row 0 mo...

獲取天氣預報

接受查詢的城市 city get city 連線redis redis new redis redis connect 127.0.0.1 6379 選擇redis資料庫 redis select 1 獲取是否已經查詢過 生命週期為半小時 res redis get city 進行判斷 if emp...

android 獲取天氣預報

第一行 中獲取天氣的方法已經不行了,天氣老是不更新。搞了大半天,現在終於搞定了。一。資料 北京通過城市名字獲得天氣資料,json資料 通過城市id獲得天氣資料,json資料 獲得json的資料為 yesterday aqi 86 city 北京 按照道理,接下去應該比較容易了,只需要對json資料解...