這是我的功能,能夠容易地您的谷歌API的代碼轉換爲MSN API:
function skycode2image ($skycode)
{
$daynight = "na";
$skycodes = array (
0 => 'thunderstorm',
1 => 'thunderstorm',
2 => 'thunderstorm',
3 => 'thunderstorm',
4 => 'thunderstorm',
5 => 'rain_snow',
6 => 'sleet',
7 => 'rain_snow',
8 => 'icy',
9 => 'icy',
10 => 'rain_snow',
11 => 'showers',
12 => 'rain',
13 => 'flurries',
14 => 'snow',
15 => 'snow',
16 => 'snow',
17 => 'thunderstorm',
18 => 'showers',
19 => 'dust',
20 => 'fog',
21 => 'haze',
22 => 'haze',
23 => 'windy',
24 => 'windy',
25 => 'icy',
26 => 'cloudy',
27 => 'mostly_cloudy',
28 => 'mostly_cloudy',
29 => 'partly_cloudy',
30 => 'partly_cloudy',
31 => 'sunny',
32 => 'sunny',
33 => 'mostly_sunny',
34 => 'mostly_sunny',
35 => 'thunderstorm',
36 => 'hot',
37 => 'chance_of_tstorm',
38 => 'chance_of_tstorm',
39 => 'chance_of_rain',
40 => 'showers',
41 - 'chance_of_snow',
42 => 'snow',
43 => 'snow',
44 => 'na',
45 => 'chance_of_rain',
46 => 'chance_of_snow',
47 => 'chance_of_tstorm');
$condition = $skycodes[$skycode];
if (in_array($skycode,array(27,29,31,33,31,45,46,47))) $daynight = 'night';
if (in_array($skycode,array(28,30,32,34,36,37,38,39,41))) $daynight = 'day';
return array($condition,$daynight);
}
得到你的天氣位置代碼是谷歌的天氣api死了好還是隻是暫時下降?我有大約15個iphone應用程序使用它,現在我受到用戶挫折感和糟糕評論的轟擊 –
到目前爲止,我所讀到的谷歌天氣api是由igoogle使用的,它不會在2013年11月前用於死亡。 –
@SamBudda不幸的是它看起來好像Google天氣API已經死了。這無疑是從iGoogle(我個人也使用過)轉變的一部分。我有一個Google協作平臺小部件,因爲它依賴Google的天氣API,因此無法使用。 由於API無證,我懷疑我們會聽到谷歌的官方迴應。據我所知,微軟的API也沒有記錄,所以我猜想它也可能會在沒有警告的情況下消失或改變。 –