Home  >  Article  >  Backend Development  >  Weather Forecast API Interface Collection_PHP Tutorial

Weather Forecast API Interface Collection_PHP Tutorial

WBOY
WBOYOriginal
2016-07-14 10:08:161326browse

For the third interface, the returned information is more comprehensive and is also provided in json format. The format is as follows
{"weatherinfo": {
//Basic information;
"city":"Beijing","city_en":"beijing",
"date_y":"February 16, 2012", "date":"", "week":"Thursday", "fchh":"11", "cityid":"101010100",
//Celsius temperature
"temp1":"2℃~-7℃",
"temp2":"1℃~-7℃",
"temp3":"4℃~-7℃",
"temp4":"7℃~-5℃",
"temp5":"5℃~-3℃",
"temp6":"5℃~-2℃",
//Fahrenheit temperature;
"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℉",
//Weather description;
"weather1":"clear",
"weather2":"clear",
"weather3":"clear",
"weather4":"Sunny turning cloudy",
"weather5":"Cloudy",
"weather6":"Cloudy to overcast",
//Weather description picture serial number
"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",
//Picture name;
"img_title1":"清",
"img_title2":"清",
"img_title3":"clear",
"img_title4":"clear",
"img_title5":"clear",
"img_title6":"clear",
"img_title7":"clear",
"img_title8":"Cloudy",
"img_title9":"Cloudy",
"img_title10":"Cloudy",
"img_title11":"Cloudy",
"img_title12":"Yin",
"img_title_single":"Qing",
//Wind speed description
"wind1":"North wind level 3-4 turning to light breeze",
"wind2":"Breeze",
"wind3":"Breeze",
"wind4":"Breeze",
"wind5":"Breeze",
"wind6":"Breeze",
//Description of wind speed level
"fx1":"North Wind",
"fx2":"Breeze",
"fl1":"Level 3-4 to less than level 3",
"fl2":"Less than level 3",
"fl3":"Less than level 3",
"fl4":"Less than level 3",
"fl5":"Less than level 3",
"fl6":"Less than level 3",
//Today’s clothing index;
"index":"cold",
"index_d":"When the weather is cold, it is recommended to wear winter clothing such as cotton coats, leather jackets and woolen sweaters. The elderly and infirm should wear thick cotton coats or winter coats.",
//48-hour clothing index
"index48":"cold",
"index48_d":"When the weather is cold, it is recommended to wear winter clothing such as cotton coats, leather jackets and woolen sweaters. The elderly and infirm should wear thick cotton coats or winter coats.",
//Ultraviolet and 48-hour UV
"index_uv":"weak",
"index48_uv":"weak",
//Car wash
"index_xc":"suitable",
//Travel
"index_tr":"General",
//Comfort Index
"index_co":"Less comfortable",
"st1":"1",
"st2":"-8",
"st3":"2",
"st4":"-4",
"st5":"5",
"st6":"-5",
//Morning exercise
"index_cl":"Less suitable",
//Drying
"index_ls":"Basically suitable",
//Allergy
"index_ag":"Extremely difficult to send"}}
The city codes for all vehicles are as follows:
101010100=Beijing
101010200=Haidian
101010300=Chaoyang
101010400=Shunyi
101010500=Huairou
101010600=Tongzhou
101010700=Changping
101010800=Yanqing
101010900=Fengtai
101011000=Shijingshan
101011100=Daxing
101011200=Fangshan
101011300=Miyun
101011400=Mentougou
101011500=平谷
101011600=Badaling
101011700=Foye Ding
101011800=Tanghekou
101011900=Miyunshangdianzi
101012000=Zhaitang
101012100=Xiayunling
101020100=Shanghai
101020200=Minhang
101020300=Baoshan
101020400=Chuansha
101020500=Jiading
101020600=Nanhui
101020700=Jinshan
101020800=Qingpu
101020900=Songjiang
101021000=Fengxian
101021100=Chongming
101021101=Chenjia Town
101021102=Pilot boat
101021200=Xujiahui
101021300=Pudong
101030100=Tianjin
101030200=Wu Qing
101030300=Baodi
101030400=Toray
101030500=Xiqing
101030600=Beichen
101030700=Ninghe
101030800=Hangu
101030900=Jinghai
101031000=Jinnan
101031100=Tanggu
101031200=Dagang
101031300=Platform
101031400=Jixian
101040100=Chongqing
101040200=Yongchuan
101040300=Hechuan
101040400=Nanchuan
101040500=Jiangjin
101040600=Wansheng
101040700=Yubei
101040800=Beibei
101040900=Banan
101041000=Longevity
101041100=Qianjiang
101041200=Wanzhou Tiancheng
101041300=Wanzhou Longbao
101041400=Fuling
101041500=Kaixian
101041600=Chengkou
101041700=Yunyang
101041800=Wuxi
101041900=Fengjie
101042000=Wushan
101042100=Tongnan
101042200=Dianjiang
101042300=Liang Ping
101042400=Zhong County
101042500=Stone Pillar
101042600=Dazu
101042700=Rongchang
101042800=Tongliang
101042900=Bishan
101043000=Fengdu
101043100=Wulong
101043200=Peng Shui
101043300=Qijiang
101043400=Youyang
101043500=Jinfo Mountain
101043600=Xiushan
101043700=Shapingba
101050101=Harbin
101050102=Twin Cities
101050103=Hulan
101050104=Acheng
101050105=Bin County
101050106=Yilan
101050107=Bayan
101050108=Tonghe
101050109=Founder
101050110=Life extension
101050111=Shangzhi
101050112=Wuchang
101050113=Mulan
101050201=Qiqihar
101050202=Nehe
101050203=Longjiang
101050204=Gannan
101050205=Rich
101050206=Ian
101050207=Baiquan
101050208=Keshan
101050209=Kedong
101050210=Tailai
101050301=Mudanjiang
101050302=Hailin
101050303=Mu Leng
101050304=Linkou
101050305=Suifenhe
101050306=Ning'an
101050307=Dongning
101050401=Jiamusi
101050402=Tang Yuan
101050403=Fuyuan
101050404=Huachuan
101050405=Hua Nan
101050406=Tongjiang
101050407=Fujin
101050501=Suihua
101050502=Zhaodong
101050503=Anda
101050504=Helen
101050505=明水
101050506=Wangkui
101050507=Lancy
101050508=Qinggang
101050509=Qing’an
101050510=Suiling
101050601=Heihe
101050602=Nenjiang
101050603=Sun Wu
101050604=Xunke
101050605=Wudalianchi
101050606=Bei’an
101050701=Daxinganling
101050702=Tahe
101050703=Mohe
101050704=Huma
101050705=Call
101050706=Xinlin
101050707=Amul
101050708=Jagedaqi
101050801=Yichun
101050802=Wuyiling
101050803=Fifth Battalion
101050804=Tieli
101050805=Jiayin
101050901=Daqing
101050902=Lindian
101050903=Zhaozhou
101050904=Zhaoyuan
101050905=Du Meng
101051002=Qitaihe
101051003=Boli
101051101=Jixi
101051102=HuLin
101051103=Mishan
101051104=Chicken
101051201=Hegang
101051202=Suibin
101051203=Luobei
101051301=Shuangyashan
101051302=Jixian
101051303=Baoqing
101051304=Raohe
101060101=Changchun
101060102=Nong’an
101060103=Dehui
101060104=Jiutai
101060105=Elm
101060106=Double Yang
101060201=Jilin
101060202=Shu Lan
101060203=Yongji
101060204=Jiaohe
101060205=Rock
101060206=Huadian
101060207=Chimney Hill
101060301=Yanji
101060302=Dunhua
101060303=Antu
101060304=Wang Qing
101060305=和龙
101060306=Tianchi
101060307=Longjing
101060308=Hunchun
101060309=Tumen
101060310=Songjiang
101060311=Luo Zigou
101060312=Yanbian
101060401=Siping
101060402=Shuangliao
101060403=Pear tree
101060404=Gongzhuling
101060405=Yitong
101060406=Gujiazi
101060501=Tonghua
101060502=Meihekou
101060503=Liuhe
101060504=Huinan
101060505=Ji’an
101060506=Tonghua County
101060601=Baicheng
101060602=Taonan
101060603=Daan
101060604=Zhenlai
101060605=Tongyu
101060701=Liaoyuan
101060702=Dongfeng
101060801= Songyuan
101060802=Qianan
101060803=Qian Guo
101060804=Channgling
101060805=Buyu
101060901=White Mountain
101060902=Jingyu
101060903=Linjiang
101060904=Donggang
101060905=Changbai
101070101=Shenyang
101070102=Sujiatun
101070103=Liaozhong
101070104=Kangping
101070105=法库
101070106=Xinmin
101070107=Yu Hong
101070108=Xinchengzi
101070201=Dalian
101070202=Wafangdian
101070203=Golden State
101070204=Pulandian
101070205=Lushun
101070206=长海
101070207=Zhuanghe
101070208=Pi Kou
101070209=Ocean Island
101070301=Anshan
101070302=Taian
101070303=Xiuyan
101070304=Haicheng
101070401=Fushun
101070403=Qingyuan
101070404=Zhang Party
101070501=Benxi
101070502=Benxi County
101070503=Caohekou
101070504=Huan Ren
101070601=Dandong
101070602=Fengcheng
101070603=Kuandian
101070604=Donggang
101070605=Donggou
101070701=Jinzhou
101070702=Linghai
101070703=Beining
101070704=Yixian
101070705=Montenegro
101070706=North Town
101070801=Yingkou
101070802=Big Stone Bridge
101070803=Gaizhou
101070901=Fuxin
101070902=张武
101071001=Liaoyang
101071002=Liaoyang County
101071003=Lighthouse
101071101=Tieling
101071102=Kaiyuan
101071103=Chantu
101071104=Xifeng
101071201=Chaoyang
101071202=Jianping
101071203=Lingyuan
101071204=Kazuo
101071205=Beipiao
101071206=Yangshan
101071207=Jianping County
101071301=Panjin
101071302=大 WA
101071303=Panshan
101071401=Huludao
101071402=Jianchang
101071403=Suizhong
101071404=Xingcheng
101080101=Hohhot
101080102=Tumut Left Banner
101080103=Tokto
101080104=Helinger
101080105=Qingshui River
101080106=Suburbs of Hohhot City
101080107=Wuchuan
101080201=Baotou
101080202=Bayon Obo
101080203=Mandula
101080204=Tumut Right Banner
101080205=Guyang
101080206=Darkhan Maoming’an United Flag
101080207=Shiguai
101080301=Wuhai
101080401=Jining
101080402=Zhuo Zi
101080403=Hua De
101080404=Shangdu
101080405=Xila Muren
101080406=Xinghe
101080407=Liangcheng
101080408=Chahar Right Front Flag
101080409=Chahar Right Center Flag
101080410=Chahar right rear flag
101080411=Siziwang Banner
101080412=Fengzhen
101080501=Tongliao
101080502=Shebotu
101080503=Horqin left center flag
101080504=Horqin left rear flag
101080505=Qinglong Mountain
101080506=Kailu
101080507=Kulun Flag
101080508=Naiman Flag
101080509=Zalut Flag
101080510=High force board
101080511=Bayar Tu Hushuo
101080512=Tongliao Qianjia Store
101080601=Chifeng
101080602=Chifeng Suburban Station
101080603=Aluhorqin Banner
101080604=Hall vomit
101080605=Bahrain Left Banner
101080606=Bahrain Right Banner
101080607=Lin Xi
101080608=Keshiketeng Banner
101080609=Wengniute Flag
101080610=Gangzi
101080611=Haraqin Banner
101080612=Balihan
101080613=Ningcheng
101080614=Aohan Banner
101080615=Bao Guo Tu
101080701=Ordos
101080703=Dalat Flag
101080704=Zhungeer Banner
101080705=Otokqianqi
101080706=Henan
101080707=Ikewusu
101080708=Otok Banner
101080709=Hangjin Banner
101080710=Wu Shen Banner
101080711=Ijinhoro Flag
101080712=Wu Shen Zhao
101080713=Dongsheng
101080801=Linhe
101080802=五元
101080803=Dengkou
101080804=Urad Front Banner
101080805=Mrs. Dashe
101080806=Urad Zhongqi
101080807=Urad Rear Flag
101080808=Helixu
101080809=Narenbaolige
101080810=Hangjinhouqi
101080811=Bameng Agricultural Experiment Station
101080901=Xilinhot
101080902=Chaokewula
101080903=Erenhot
101080904=Abaga Banner
101080905=Yihe Gol
101080906=Sunit Left Banner
101080907=Sunit Right Banner
101080908=Zhu Rihe
101080909=East Ujimqin Banner
101080910=West Ujimqin Banner
101080911=Taipu Temple Flag
101080912=With yellow flag
101080913=White flag
101080914=Zhenglan Banner
101080915=Duolun
101080916=Boktu
101080917=Ulagai
101080918=白日wula
101080919=Picture of that day
101081000=Hulunbuir
101081001=Hyrule
101081002=Xiaoergou
101081003=Arong Banner
101081004=Moridawa Flag
101081005=Oroqen Banner
101081006=Evenki Banner
101081007=Chen Balhu Banner
101081008=New Balhu Left Banner
101081009=New Balhu Right Banner
101081010=Manzhouli
101081011=Yakeshi
101081012=Zhalantun
101081014=Ergun
101081015=Genhe
101081016=Turi River
101081101=Ulanhot
101081102=Alshan
101081103=Horqin right center flag
101081104=Hurle
101081105=Zhalaite Banner
101081106=Sauron
101081107=Tuquan
101081108=Holingol
101081201=Alxa Left Banner
101081202=Alxa Right Banner
101081203=Ejina Banner
101081204=Guaizi Lake
101081205=Jilanta
101081206=Xilingol
101081207=Toudao Lake
101081208=中秋子
101081209=Bayan Norgon
101081210=Yabulai
101081211=Ustai
101081212=Twin Well Beach
101090101=Shijiazhuang
101090102=Jingxing
101090103=Zhengding
101090104=Luancheng
101090105=Xing Tang
101090106=Lingshou
101090107=Gaoyi
101090108=Fukasawa
101090109=Zanhuang
101090110=无极
101090111=平山
101090112=Yuanshi
101090113=Zhao County
101090114=Xinji
101090115=Gaocheng
101090116=Jinzhou
101090117=Xinle
101090201=Baoding
101090202=Mancheng
101090203=Fuping
101090204=Xushui
101090205=Tang County
101090206=Gao Yang
101090207=Rongcheng
101090208=Zijingguan
101090209=Laiyuan
101090210=Wangdu
101090211=Anxin
101090212=Yixian
101090213=Laishui
101090214=Quyang
101090215=Li County
101090216=Shunping
101090217=Xiong County
101090218=Zhuozhou
101090219=Dingzhou
101090220=Anguo
101090221=Gaobeidian
101090301=Zhangjiakou
101090302=Xuanhua
101090303=Zhang Bei
101090304=Kangbao
101090305=Guyuan
101090306=Shangyi
101090307=Yu County
101090308=Yangyuan
101090309=Huaian
101090310=Safeguard
101090311=Huailai
101090312=Zhuolu
101090313=Akagi
101090314=Chongli
101090402=Chengde
101090403=Chengde County
101090404=Xinglong
101090405=Hiraizumi
101090406=Luanping
101090407=Longhua
101090408=Fengning
101090409=Kuancheng
101090410=Paddock
101090411=saihankan
101090501=Tangshan
101090502=Fengnan
101090503=Fengrun
101090504=Luan County
101090505=Luannan
101090506=Leting
101090507=Qianxi
101090508=玉田
101090509=Tang Hai
101090510=Zunhua
101090511=Qian’an
101090601=Langfang
101090602=Gu'an
101090603=Yongqing
101090604=Xianghe
101090605=大城
101090606=Wen An
101090607=Dachang
101090608=Bazhou
101090609=三河
101090701=Cangzhou
101090702=Qingxian
101090703=东光
101090704=Haixing
101090705=Salt Mountain
101090706=Suning
101090707=Nanpi
101090708=Wu Qiao
101090709=Xian County
101090710=Mengcun
101090711=Botou
101090712=Renqiu
101090713=Huang Hua
101090714=Hejian
101090715=Caofeidian
101090801=Hengshui
101090802=Zaoqiang
101090803=武邑
101090804=武强
101090805=Rao Yang
101090806=Anping
101090807=Old City
101090808=Jingxian
101090809=Fucheng
101090810=Jizhou
101090811=Shenzhou
101090901=Xingtai
101090902=Lincheng
101090903=Xingtai County Pulp Water
101090904=Neiqiu
101090905=Baixiang
101090906=Longyao
101090907=Nanhe
101090908=Ning Jin
101090909=Giant Deer
101090910=Xinhe
101090911=Guangzong
101090912=Pingxiang
101090913=Wei County
101090914=Qinghe
101090915=Linxi
101090916=Nangong
101090917=Shahe
101090918=Ren County
101091001=Handan
101091002=Fengfeng
101091003=Linzhang
101091004=成安
101091005=Daimyo
101091006=Shexian County
101091007=Cixian County
101091008=Feixiang
101091009=Yongnian
101091010=Qiu County
101091011=Chize
101091012=Guangping
101091013=Guantao
101091014=Wei County
101091015=Quzhou
101091016=武安
101091101=Qinhuangdao
101091102=青龙
101091103=Changli
101091104=Funing
101091105=Lulong
101091106=Beidaihe
101100101=Taiyuan
101100102=Qingxu
101100103=Yangqu
101100104=Lou Fan
101100105=Taiyuan Gujiao District
101100106=Northern Suburbs of Taiyuan
101100107=Southern Suburbs of Taiyuan
101100201=Datong
101100202=Yanggao
101100203=Datong County
101100204=Tianzhen
101100205=Guangling
101100206=Lingqiu
101100207=Hunyuan
101100208=Zuo Yun
101100301=Yangquan
101100302=Yuxian County
101100303=Pingding
101100401=Jinzhong
101100402=Yuci
101100403=Yumshe
101100404=Zuo Quan
101100405=Heshun
101100406=Xiyang
101100407=Shouyang
101100408=Taegu
101100409=Qixian
101100410=Pingyao
101100411=Spiritual Stone
101100412=Jiexiu
101100501=Changzhi
101100502=Licheng
101100503=tunliu
101100504=Lucheng
101100505=Xiangyuan
101100506=Smooth
101100507=Wuxiang
101100508=Qin County
101100509=eldest son
101100510=Qinyuan
101100511=Huguan
101100601=Jincheng
101100602=Qinshui
101100603=Yangcheng
101100604=Lingchuan
101100605=Gaoping
101100701=Linfen
101100702=Quwo
101100703=Yonghe
101100704=Xi County
101100705=Daning
101100706=Ji County
101100707=Xiangfen
101100708=Pu County
101100709=fenxi
101100710=Hongdong
101100711=Huozhou
101100712=Xiangning
101100713=Yicheng
101100714=Hou Ma
101100715=Fushan
101100716=Anze
101100717=Guxian
101100801=Yuncheng
101100802=Linyi
101100803=Jishan
101100804=Wanrong
101100805=Hejin
101100806=New Jiang
101100807=Jiang County
101100808=Wenxi
101100809=Yuanqu
101100810=Yongji
101100811=Ruicheng
101100812=Xia County
101100813=Pinglu
101100901=Shuozhou
101100902=Pinglu
101100903=Sanin
101100904=Youyu
101100905=Yingxian
101100906=Huairen
101101001=Xinzhou
101101002=Dingxiang
101101003=Dou Village, Wutai County
101101004=Hequ
101101005=Piangguan
101101006=Sacred Pond
101101007=Ning Wu
101101008=Dai County
101101009=Fanzhi
101101010=Wutai Mountain
101101011=Baode
101101012=Jingle
101101013=粢兰
101101014=Wuzhai
101101015=Yuanping
101101100=Lu Liang
101101101=Lishi
101101102=Linxian
101101103=Xingxian
101101104=Lan County
101101105=Liu Lin
101101106=Shilou
101101107=Fangshan
101101108=Jiaokou
101101109=中阳
101101110=Xiaoyi
101101111=fenyang
101101112=文水
101101113=Jiaocheng
101110101=Xi’an
101110102=Chang'an
101110103=Lintong
101110104=Lantian
101110105=Zhou Zhi
101110106=Hu County
101110107=Gaoling
101110108=Yang Ling
101110200=Xianyang
101110201=Mihara
101110202=Liquan
101110203=Yongshou
101110204=Chunhua
101110205=Jingyang
101110206=Martial Arts
101110207=Qian County
101110208=Bin County
101110209=Changwu
101110210=Xunyi
101110211=Xingping
101110300=Yan'an
101110301=Extension
101110302=Yancuan
101110303=子长
101110304=Yichuan
101110305=Fu County
101110306=Zhidan
101110307=Ansai
101110308= Sweet Spring
101110309=Luochuan
101110310=Huangling
101110311=Huanglong
101110312=Wu Qi
101110401=Yulin
101110402=Fugu
101110403=神木
101110404=Jiaxian
101110405=Fixed edge
101110406=Jingbian
101110407=Hengshan
101110408=MiZhi
101110409=Zizhou
101110410=Suide
101110411=Wubao
101110412=Qingjian
101110501=Weinan
101110502=Huaxian
101110503=Tongguan
101110504=Dali
101110505=白水
101110506=Fuping
101110507=Pucheng
101110508=Chengcheng
Of course, it is also possible to query by using the Chinese pinyin of the city name. For example: The following is the weather in Beijing
If you want the latitude and longitude coordinates of other regions, you can query them through the country code list and the corresponding city latitude and longitude coordinates list provided by Google API. The following are the query parameters provided by Google API:
(Query the codes of all countries supported by Google and display them in zh-cn simplified Chinese)
Google has opened a weather forecast API, which is very useful.
Use zip code (USA)
http://www.google.com/ig/api?hl=zh-cn&weather=94043(Mountain View, California)
What countries and cities can be found? Google also provides an interface. The return type can also be specified based on the output parameter.
With this data, it is not difficult to add weather forecast to your own application.
Google’s weather forecast API. The advantage is that you can directly obtain the countries and cities that support weather query. It can also forecast weather for 4 days and support weather query by longitude and latitude (this can be applied using GPS). www.2cto.com
The shortcomings are also amazing: there are relatively few Chinese cities supported. For specific information, you can check http://www.google.com/ig/cities?hl=zh-cn&country=cn.
Yahoo Weather API
The url of yahoo weather forecast is
http://weather.yahooapis.com/forecastrss?w=2151330&u=c (returns XML data)
Tell me what the parameters inside mean:
The parameter w corresponds to the WOEID of various places in the Yahoo database. For example, the WOEID of Beijing is 2151330. Currently, the parameter p can also be used to replace w, but the official recommendation is to use w. It seems that p is planned to be cancelled. The parameter u is used to determine the unit of temperature (c is degrees Celsius and f is degrees Fahrenheit). For weather queries in China (no comparison abroad), YAHOO is relatively comprehensive in terms of the places that can be found and the content of the forecast.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477798.htmlTechArticleFor the third interface, the returned information is more comprehensive and is also provided in json format. The format is as follows {weatherinfo: { / /Basic information; city: Beijing, city_en: beijing, date_y: February 16, 2012, da...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn