xml = "http://www.google.com/ig/api?weather=" . $location; //loads xml feed $this->data = simplexml_load_file($this->xml); //checks if location specified is legitimate if($data->weather->problem_cause){ return false; }else{ //return locale name and sets variables $this->city = $this->data->weather->forecast_information->city['data']; $this->current = array("condition" => $this->data->weather->current_conditions->condition['data'], "temp_f" => $this->data->weather->current_conditions->temp_f['data'], "temp_c" => $this->data->weather->current_conditions->temp_c['data'], "humidity" => $this->data->weather->current_conditions->humidity['data'], "icon" => substr($this->data->weather->forecast_conditions[0]->icon['data'], 3)); $this->fc0 = array("day" => $this->data->weather->forecast_conditions[0]->day_of_week['data'], "icon" => substr($this->data->weather->forecast_conditions[0]->icon['data'], 4), "condition" => $this->data->weather->forecast_conditions[0]->condition['data']); $this->fc1 = array("day" => $this->data->weather->forecast_conditions[1]->day_of_week['data'], "icon" => substr($this->data->weather->forecast_conditions[1]->icon['data'], 4), "condition" => $this->data->weather->forecast_conditions[1]->condition['data']); $this->fc2 = array("day" => $this->data->weather->forecast_conditions[2]->day_of_week['data'], "icon" => substr($this->data->weather->forecast_conditions[2]->icon['data'], 4), "condition" => $this->data->weather->forecast_conditions[2]->condition['data']); $this->fc3 = array("day" => $this->data->weather->forecast_conditions[3]->day_of_week['data'], "icon" => substr($this->data->weather->forecast_conditions[3]->icon['data'], 4), "condition" => $this->data->weather->forecast_conditions[3]->condition['data']); return $this->city; } } //methods to change icon paths function set_forecast0icon($icon){ if($this->fc0['icon'] = $icon){ return true; } } function set_forecast1icon($icon){ if($this->fc1['icon'] = $icon){ return true; } } function set_forecast2icon($icon){ if($this->fc2['icon'] = $icon){ return true; } } function set_forecast3icon($icon){ if($this->fc3['icon'] = $icon){ return true; } } function get_location(){ return $this->city; } function get_current(){ return $this->current; } function get_forecast0(){ return $this->fc0; } function get_forecast1(){ return $this->fc1; } function get_forecast2(){ return $this->fc2; } function get_forecast3(){ return $this->fc3; } } ?>