Use GoogleAPI to write a php code for viewing weather forecasts
Forecast_information-> city; if (isset ($ xml ['weate']-> problem_cause) {$ problem = (array) $ xml ['weate']-> problem_cause; echo $ problem ['@ attributes'] ['data']; return;} $ conditions = (array) $ xml ['weate']-> current_conditions-> condition; $ humidity = (array) $ xml ['weight']-> current_conditions-> humidity; $ temp_c = (array) $ xml ['weight']-> current_conditions-> temp_c; $ conditions_icon = (array) $ xml ['weight']-> current_conditions-> icon; $ wind_condition = (array) $ xml ['weight']-> current_conditions-> wind_condition; $ forecast = (array) $ xml ['weate']; $ forecast = (array) $ forecast ['forecast _ conditions ']; $ html = ''; foreach ($ forecast as $ key => $ val) {$ {'Day _ of_week _'. $ key} = (array) $ val-> day_of_week; $ {'low _'. $ key} = (array) $ val-> low; $ {'high _'. $ key} = (array) $ val-> high; $ {'icon _'. $ key} = (array) $ val-> icon; $ {'condition _'. $ key} = (array) $ val-> condition; $ html. = "{$ {'Day _ of_week _'. $ key} ['@ bubutes'] ['data']} http://www.google.com {$ {'Icon _'. $ key} ['@ bubutes'] ['data']} \ "width = 40 height = 40 >{$ {'low _'. $ key} ['@ bubutes'] ['data']} °C | {$ {'high _'. $ key} ['@ bubutes'] ['data']} °C ";} self: printCss (); echo <{$ city ['@ bubutes'] ['data']} http://www.google.com {$ Conditions_icon ['@ bubutes'] ['data']} "width = 40 height = 40> {$ temp_c ['@ attributes'] ['data']} °C current: {$ conditions ['@ bubutes'] ['data']} {$ wind_condition ['@ attributes'] ['data']} {$ humidity ['@ attributes'] ['data']} $ html weather ;} /*** print style */static public function printCss () {echo <css ;} /*** create xml cache ** @ param $ content to be cached by contents */static private function cacheXML ($ contents) {$ contents = st R_ireplace (''," \ n ", $ contents); $ contents = mb_convert_encoding ($ contents, 'utf-8', 'gbk'); file_put_contents (self :: $ weatherXML, $ contents) or die ('No write authorization') ;}} weather: getXML (); weather: analysisXML ();?>