在应用开发中,我们常常会用到天气预报的信息,其实很多网站都已经提供了免费的天气预报API,我们直接调用就可以获取,下面就介绍一下国家气象局提供的天气预报API接口。
在应用开发中,我们常常会用到天气预报的信息,其实很多网站都已经提供了免费的天气预报API,我们直接调用就可以获取,下面就介绍一下国家气象局提供的天气预报API接口。
接口地址:
对于第三个接口,返回信息比较全面,也是以json格式提供,格式如下{"weatherinfo":{//基本信息;"city":"
北京","city_en":"beijing","date_y":"2012年2月16日","date":"","week":"星期四","fchh":"11","cityid":"101010100",//摄氏温度"temp1":"2℃~-7℃","temp2":"1℃~-7℃","temp3":"4℃~-7℃","temp4":"7℃~-5℃","temp5":"5℃~-3℃","temp6":"5℃~-2℃",//华氏温度;"tempF1":"35.6℉~19.4℉","tempF2":"33.8℉~19.4℉","tempF3":"39.2℉~19.4℉","tempF4":"44.6℉~23℉","tempF5":"41℉~26.6℉","tempF6":"41℉~28.4℉",//天气描述;"weather1":"晴","weather2":"晴","weather3":"晴","weather4":"晴转多云","weather5":"多云","weather6":"多云转阴",//天气描述图片序号"img1":"0","img2":"99","img3":"0","img4":"99","img5":"0","img6":"99","img7":"0","img8":"1","img9":"1","img10":"99","img11":"1","img12":"2","img_single":"0",//图片名称;"img_title1":"晴","img_title2":"晴","img_title3":"晴","img_title4":"晴","img_title5":"晴","img_title6":"晴","img_title7":"晴","img_title8":"多云","img_title9":"多云","img_title10":"多云","img_title11":"多云","img_title12":"阴","img_title_single":"晴",//风速描述"wind1":"北风3-4级转微风"