title: How to escape '&' using PHP simplexml_load_file()?
body: <p>I am fetching XML file from remote url, but when '&amp;' character occurs in XML, simplexml_load_file fails:</p>
  
  <pre><code>$url = 'https://domain.com/xml.php?xmlid=123;
  
  
  print_r($url);
  
  if (simplexml_load_file($url))
  {
      $orderDetailsXMLData = simplexml_load_file($url);
  }
  else
  {
      echo "Failed!";
  }
  </code></pre>
  
  <p>XML sample file which fails is as follows:</p>
  
  <p><strong>Note, I don't have control over the source XML</strong></p>
  
  <p>
  
  
  1
  Company1
  </p>
  
  <pre><code>&lt;info&gt;
  &lt;ccode&gt;2&lt;/ccode&gt;
  &lt;company&gt;Company2&lt;/company&gt;
  &lt;/info&gt;
  &lt;info&gt;
  &lt;ccode&gt;2&lt;/ccode&gt;
  &lt;company&gt;Company Sons &amp; Sons&lt;/company&gt;
  &lt;/info&gt;
  &lt;/companies&gt;
  </code></pre>
  
  <p>Is there any way to escape XML before importing?</p>