1、直接用iframe
http://www.tianqi.com/plugin/
2、weather.com.cn 智慧天气应用编程接口开放平台 – 文档、图标下载
http://weather.com.cn/wzfw/smart/weatherapi.shtml
3、中国气象局提供了三个天气查询的API接口
http://www.weather.com.cn/data/sk/101190101.html
http://www.weather.com.cn/data/cityinfo/101190101.html
http://m.weather.com.cn/data/101190101.html
以json格式返回数据,第一和第二个接口返回当天实时的天气数据,第三个返回未来五天天气情况。
其中地址里的数字表示城市的代码:101190101 代表南京
第三个接口的返回数据示例及说明如下:
{
weatherinfo: {
city: "南京",
city_en: "nanjing",
date_y: "2013年9月8日",
date: "",
week: "星期日",
fchh: "18",
cityid: "101190101", //城市代码
temp1: "22℃~30℃", //第一天(当天)最高喝最低温度(摄氏温度)
temp2: "23℃~29℃", //第二天最高喝最低温度(摄氏温度)
temp3: "22℃~28℃", //第三天最高喝最低温度(摄氏温度)
temp4: "23℃~30℃", //第四天最高喝最低温度(摄氏温度)
temp5: "24℃~28℃", //第五天最高喝最低温度(摄氏温度)
temp6: "23℃~28℃", //第六天最高喝最低温度(摄氏温度)
tempF1: "71.6℉~86℉", //第一天(当天)最高喝最低温度(华氏温度)
tempF2: "73.4℉~84.2℉", //第二天最高喝最低温度(华氏温度)
tempF3: "71.6℉~82.4℉", //第三天最高喝最低温度(华氏温度)
tempF4: "73.4℉~86℉", //第四天最高喝最低温度(华氏温度)
tempF5: "75.2℉~82.4℉", //第五天最高喝最低温度(华氏温度)
tempF6: "73.4℉~82.4℉", //第六天最高喝最低温度(华氏温度)
weather1: "多云转阴", //第一天(当天)天气
weather2: "小雨", //第二天天气
weather3: "小雨",
weather4: "阴",
weather5: "小雨转中雨",
weather6: "中雨转阴",
img1: "1", //第一天的天气图片代码1
img2: "2", //第一天的天气图片代码2
img3: "7", //第二天的天气图片代码1
img4: "99", //第二天的天气图片代码2
img5: "7",
img6: "99",
img7: "2",
img8: "99",
img9: "7",
img10: "8",
img11: "8",
img12: "2",
img_single: "2"
img_title1: "多云", //第一天的天气图片1的标题
img_title2: "阴", //第一天的天气图片2的标题
img_title3: "小雨", //第二天的天气图片1的标题
img_title4: "小雨", //第二天的天气图片2的标题
img_title5: "小雨",
img_title6: "小雨",
img_title7: "阴",
img_title8: "阴",
img_title9: "小雨",
img_title10: "中雨",
img_title11: "中雨",
img_title12: "阴",
img_title_single: "阴",
wind1: "东风3-4级", //第一天风向范围
wind2: "东风3-4级", //第二天风向范围
wind3: "北风转东北风3-4级",
wind4: "东北风3-4级",
wind5: "东北风转西风3-4级",
wind6: "西南风转西风3-4级",
fx1: "东风",
fx2: "东风",
fl1: "3-4级", //第一天风级范围
fl2: "3-4级",
fl3: "3-4级",
fl4: "3-4级",
fl5: "3-4级",
fl6: "3-4级",
index: "热", //二十四小时穿衣指数
index_d: "天气热,建议着短裙", //建议
index48: "热", //四十八小时穿衣指数
index48_d: "天气热,建议着短裙", //建议
index_uv: "弱", //二十四小时紫外线
index48_uv: "弱", //四十八小时紫外线
index_xc: "不宜", //洗车
index_tr: "适宜", //旅游
index_co: "较舒适", //舒适度
st1: "30",
st2: "20",
st3: "27",
st4: "19",
st5: "26",
st6: "18",
index_cl: "较适宜", //晨练
index_ls: "不太适宜", //晾晒
index_ag: "极易发" //过敏
}
}
参考:http://www.cnblogs.com/laosan/p/how-to-write-a-weather-api.html