I want to show the weather from Google. Found a script breakdown hml with the weather. I want to show it on the site. But something is clearly wrong, and apparently with quotes. And on the server they chopped off the display of errors, and I do not understand what and where exactly is wrong.

function getWeather() { $requestAddress = "http://www.google.com/ig/api?weather=Paris"; $xml_str = file_get_contents($requestAddress,0); $xml = new SimplexmlElement($xml_str); $count = 0; $res = ''; $res .="<div id=\"weather\">"; foreach($xml->weather as $item) { foreach($item->forecast_conditions as $new) { $res .= '<div class="weatherIcon">'; $res .= '<img src="http://www.google.com/' .$new->icon['data'] . '"/><br/>'; $res .= $new->day_of_week['data']; $res .= '</div>'; } } $res .="</div>"; return $res; } 
  • 2
    The markup answered you =) - Sh4dow

1 answer 1

 //$res = "; $res = ''; 
  • Still somewhere a mistake. - Tchort
  • On another server where the errors are shown, I saw this: Fatal error: Uncaught exception 'Exception' with message 'XML in /index.php:40 Stack trace: # 0 /index.php(40): SimpleXMLElement -> __ construct ('<? xml version = "...') # 1 - Tchort
  • Well, can you translate something? The string cannot be parsed as xml. So, in the xml error itself. - Sh4dow
  • Google gives a bad hml? :) - Tchort
  • see above) - Sh4dow