title: Curl and htmlentities stripping XML tags
body: <p>So i'm working on a php script which passes information to a server using Curl and the POST method and then takes back information from that server in the form of XML.I then want to take this information and parse it into a readable format for the user. </p>
  
  <p>I grab the information using curl and load it into a variable ($result) which i then want to load into simpleXML and store in the variable $routeinfo. However when I perform a var_dump($routeinfo) there doesn't appear to be any data stored. I've confirmed that there is data present in $result by echoing it. </p>
  
  <p>I also figured it may have been due to the XML not showing up in the browser when I echoed $result(but it is there if I check the source). Just to check though I used htmlentities but that causes a lot of errors because &lt; is interpreted as it's html equivalent. Anyway I've reached an impass and have logged quite a few hours implementing different suggestions to no avail. My code is below and I would appreciate any help that can be rendered.</p>
  
  <pre><code>&lt;?php 
  //retrieve form data in a variable
  $input = $_POST['stopNo'] ;
  
  //declare other variables needed
  $api_key = 'xxxkey' ;
  $api_id = 12345 ;
  $url = 'url to send data to' ; 
  $querystring = "appID=". $api_id . "&amp;apiKey=" . $api_key . "&amp;stopNo" . $input ;
  $data = urlencode($url) ; 
  
  
  //curl using
  
  $ch = curl_init() ; 
  
  //set up curl
  
  curl_setopt($ch, CURLOPT_URL, 'urlsendingdatato');
  curl_setopt($ch, CURLOPT_POSTFIELDS, 'appID='.urlencode($api_id).'&amp;apiKey=' .urlencode($api_key) . '&amp;stopNo=' .urlencode($input) );
  curl_setopt($ch, CURLOPT_POST, 1); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0 ) ; 
  curl_setopt($ch, CURLOPT_ENCODING, "UTF-8") ;
  curl_setopt($ch, CURLOPT_BINARYTRANSFER , TRUE) ;
  
  
  //execute and gather info
  $result = curl_exec($ch) ; 
  
  //close connection
  curl_close($ch) ;
  
  //format data 
  //ent at the moment serves no purpose doesn't render the information correctly
  $ent = htmlentities($result);
  $routeinfo = new SimpleXMLElement($result) ;
  
  //print data
  echo "&lt;br&gt; $result &lt;br&gt;" ; 
  var_dump($routeinfo) ;
  
  
  ?&gt; 
  </code></pre>