title: Problems getting gzipped XML files with curl PHP
body: <p>I'm trying to grab data from an xml.gz file with curl.  I'm able to download the file, but can't get the usable XML with any of my attempts.  When I try to print the XML, I'm getting a long list of garbled special characters such as:</p>
  
  <pre><code>‹ì½ûrâÈ–7ú?E~{Çž¨Ši°î—Ù5=ÁÍ6]`Ø€ë²ãDLÈ u
  </code></pre>
  
  <p>Is there a simple way to just uncompress and encode this xml?  Possibly through SimpleXML?  The files are large and do require authentication.  Here's my current code:</p>
  
  <pre><code>$username='username';
  $password='password';
  $location='http://www.example.com/file.xml.gz';
  
  
  $ch = curl_init ();
  curl_setopt($ch,CURLOPT_URL,$location);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_USERPWD,"$username:$password");
  curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  
  $xmlcontent = curl_exec ($ch); 
  curl_close($ch);
  
  print_r($xmlcontent);
  </code></pre>
  
  <p>Thanks for your help!</p>