title: Cakephp 2.0: Errors with Google Weather API + Xml
body: <p>I have created an Element for my project which loads the Google Weather API. Locally it works perfectly. The problem appeared when I uploaded it and when I gave it to a friend of mine to try it.</p>
  
  <p>The code for the element is the following one</p>
  
  <pre><code>&lt;?php
  Configure::write('debug', 2);
  
  $xml = simplexml_load_file('http://www.google.com/ig/api?weather=name_city');
  $information = $xml-&gt;xpath("/xml_api_reply/weather/forecast_information");
  $current = $xml-&gt;xpath("/xml_api_reply/weather/current_conditions");
  $forecast_list = $xml-&gt;xpath("/xml_api_reply/weather/forecast_conditions");
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Google Weather API&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;&lt;?= print $information[0]-&gt;city['data']; ?&gt;&lt;/h1&gt;
  &lt;h2&gt;Today's weather&lt;/h2&gt;
  &lt;div class="weather"&gt;
  &lt;?php $icon_today = (string) $current[0]-&gt;condition['data'];?&gt;
  
  &lt;?php echo $this-&gt;Html-&gt;image('tick/'.$icon_today.'.png');?&gt;
          &lt;span class="condition"&gt;
          &lt;?= $current[0]-&gt;temp_c['data'] ?&gt;&amp;deg; C,
  
          &lt;/span&gt;
   &lt;/div&gt;
  &lt;h2&gt;Forecast&lt;/h2&gt;
      &lt;? foreach ($forecast_list as $forecast) : ?&gt;
      &lt;div class="weather"&gt;
      &lt;?php $icon = (string) $forecast-&gt;condition['data'];?&gt;
        &lt;?php echo $this-&gt;Html-&gt;image('tick/'.$icon.'.png',array('width' =&gt; '45'));?&gt;
  
          &lt;div&gt;&lt;?= $forecast-&gt;day_of_week['data']; ?&gt;&lt;/div&gt;
          &lt;span class="condition"&gt;
          &lt;?php
          $low = (int) $forecast-&gt;low['data'];
          $high = (int) $forecast-&gt;high['data'];
          $low_celsius = (int) (($low - 32) * (5/9));
          $high_celsius = (int)(($high - 32) * (5/9));
          ?&gt;
              &lt;?= $low_celsius ?&gt;&amp;deg; C - &lt;?= $high_celsius ?&gt;&amp;deg; C,
              &lt;?= $forecast-&gt;condition['data'] ?&gt;
          &lt;/span&gt;
   &lt;/div&gt;
  &lt;? endforeach ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I uploaded it I got these messages</p>
  
  <pre><code>Warning (2): simplexml_load_file() [function.simplexml-load-file]:     
  http://www.google.com/ig/api?weather=name_city: parser error : Document is empty     
  [APP/View/Elements/weather.ctp, line 5]
  Warning (2): simplexml_load_file() [function.simplexml-load-file]:   
  [APP/View/Elements/weather.ctp, line 5]
  Warning (2): simplexml_load_file() [function.simplexml-load-file]: ^ 
  [APP/View/Elements/weather.ctp, line 5]
  Warning (2): simplexml_load_file() [function.simplexml-load-file]: 
  http://www.google.com/ig/api?weather=name_city:1: parser error : Start tag 
  expected, '&lt;' not found [APP/View/Elements/weather.ctp, line 5]
  Warning (2): simplexml_load_file() [function.simplexml-load-file]:  
  [APP/View/Elements/weather.ctp, line 5]
  Warning (2): simplexml_load_file() [function.simplexml-load-file]: ^ 
  [APP/View/Elements/weather.ctp, line 5]
  Fatal error: Call to a member function xpath() on a non-object in 
  /home/wwwsite/public_html/testing/app/View/Elements/weather.ctp on line 6
  </code></pre>
  
  <p><strong>name_city</strong> has a real value. When I tried it on another computer there where other types of error (<strong>$forecast->day_of_week['data']</strong> for example was not recognized as a valid variable).  It seems that the online version is not able to receive data from Google Weather so the result is empty. Could anyone please tell me what to do?</p>