title: simplexml_load_file ampersand in url
body: <p>We have a simple PHP script that loads the server status from an external XML file like this:</p>
  
  <pre><code>$xml = simplexml_load_file("http://domain.com/?module=server&amp;action=status-xml");
  foreach ($xml-&gt;Group-&gt;Server-&gt;attributes() as $nodename =&gt; $value){
      if ($nodename == $param){
          return $value;
      }
  }
  </code></pre>
  
  <p>When the script runs, we get a internal server error 500. Looking at the error log, we see the following: <a href="http://i.stack.imgur.com/alOYI.png" rel="nofollow">http://i.stack.imgur.com/alOYI.png</a></p>
  
  <p>Basically, the <strong>&amp;</strong> in the URL is getting urlencoded (at run time, somehow) into <strong>&amp; amp ;</strong></p>
  
  <p>Any idea why this is happening? This was on a apache2 /w php-fpm setup. Is this some sort of security setting?</p>