title: 'Node no longer exists' error in PHP
body: <p>I'm using the following code to turn user's IP into latitude/longitude information using the hostip web service:</p>
  
  <pre><code>//get user's location
  $ip=$_SERVER['REMOTE_ADDR'];
  
  function get_location($ip) {
      $content = file_get_contents('http://api.hostip.info/?ip='.$ip);
      if ($content != FALSE) {
          $xml = new SimpleXmlElement($content);
          $coordinates = $xml-&gt;children('gml', TRUE)-&gt;featureMember-&gt;children('', TRUE)-&gt;Hostip-&gt;ipLocation-&gt;children('gml', TRUE)-&gt;pointProperty-&gt;Point-&gt;coordinates;
          $longlat = explode(',', $coordinates);
          $location['longitude'] = $longlat[0];
          $location['latitude'] = $longlat[1];        
                  $location['citystate'] = '==&gt;'.$xml-&gt;children('gml', TRUE)-&gt;featureMember-&gt;children('', TRUE)-&gt;Hostip-&gt;children('gml', TRUE)-&gt;name;
          $location['country'] =  '==&gt;'.$xml-&gt;children('gml', TRUE)-&gt;featureMember-&gt;children('', TRUE)-&gt;Hostip-&gt;countryName;
          return $location;
      }
      else return false;
  }
  
  $data = get_location($ip);
  
  $center_long=$data['latitude'];
  $center_lat=$data['longitude'];
  </code></pre>
  
  <p>This works fine for me, using $center_long and $center_lat the google map on the page is centered around my city, but I have a friend in Thailand who tested it from there, and he got this error:</p>
  
  <pre><code>Warning: get_location() [function.get-location]: Node no longer exists in /home/bedbugs/registry/index.php on line 21
  </code></pre>
  
  <p>So I'm completely confused by this, how could he be getting an error if I don't? I tried googling it and it has something to do with parsing XML data, but the parsing process is the same for me and him. Note that line 21 is the one that starts with <code>'$coordinates ='</code> .</p>