title: SimpleXML Redirection Limit Reached
body: <p>I am trying to open an XML file on a remote server, but I get an error that says the redirection limit is reached. I have no control over the remote, so is there a way that I can increase that limit? Or, should I talk to the person who owns the server and see what they can do?</p>
  
  <p>This is the error:</p>
  
  <blockquote>
    <p>Warning:
    simplexml_load_file(<a href="http://www.server.com/search/music.xml?key=key&amp;type=songs&amp;p1=All%20Things%20New&amp;p2=Elevation%20Worship" rel="nofollow">http://www.server.com/search/music.xml?key=key&amp;type=songs&amp;p1=All%20Things%20New&amp;p2=Elevation%20Worship</a>)
    [function.simplexml-load-file]: failed to open stream: Redirection
    limit reached, aborting in /home/admin/public_html/art/art.php on
    line 4</p>
    
    <p>Warning: simplexml_load_file() [function.simplexml-load-file]: I/O
    warning : failed to load external entity
    "<a href="http://www.server.com/search/music.xml?key=key&amp;type=songs&amp;p1=All%20Things%20New&amp;p2=Elevation%20Worship" rel="nofollow">http://www.server.com/search/music.xml?key=key&amp;type=songs&amp;p1=All%20Things%20New&amp;p2=Elevation%20Worship</a>"
    in /home/admin/public_html/art/art.php on line 4</p>
    
    <p>Fatal error: Call to a member function xpath() on a non-object in
    /home/admin/public_html/art/art.php on line 6</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>&lt;?php
  function errorHandler($n, $m, $f, $l) {
      header('Location: blank.png');
  }
  
  set_error_handler('errorHandler');
  
  $url = 'http://REMOTESERVER/search/music.xml?key=KEY&amp;type=songs&amp;p1=' . htmlspecialchars($_GET["track"]) . '&amp;p2=' . htmlspecialchars($_GET["artist"]) . '';
  $xml = simplexml_load_file($url);
  
  $img = $xml-&gt;xpath('//image200');
  
  $large = (string)$img[0];
  
  header("Location:".urldecode($large));
  ?&gt;
  </code></pre>