title: Loading a secure file with cURL
body: <p>I'm trying to use cURL to access a secure file.. The documentation for its use is confusing so I searched and found two sites (<a href="http://blog.taragana.com/index.php/archive/how-to-use-curl-in-php-for-authentication-and-ssl-communication/" rel="nofollow noreferrer">1</a> &amp; <a href="http://blogs.digitss.com/php/php-downloading-a-file-from-secure-website-https-using-curl/" rel="nofollow noreferrer">2</a>) and a reference <a href="https://stackoverflow.com/questions/564682/php-to-read-secured-file">here on SO</a> but the scripts don't seem to work for me.</p>
  
  <p>The site I'm am trying to access has the data I need publicly available, so I don't need to log in or provide a password.</p>
  
  <p>This is the script I have and all it does is sit there waiting for something to happen (I get no errors).</p>
  
  <pre><code>$ch = curl_init('https://www.somesite.com/index.htm');
  
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  
  // Disable PEER SSL Verification: If you are not running with SSL or if you don't have valid SSL
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  
  // Disable HOST (the site you are sending request to) SSL Verification,
  // if Host can have certificate which is nvalid / expired / not signed by authorized CA.
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  
  $sFile = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>I just need to figure out what I'm doing wrong here.
  Thanks!</p>
  
  <p>Update: The script does work locally in XAMPP, but not on the live server (am I missing a php setting? - probably something I can't touch because I'm using a free hosting service, for now). I also found <a href="http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/" rel="nofollow noreferrer">this article</a> about grabbing a certificate, but it isn't clear to me if I need to grab the one from delicious or the site I'm trying to access.</p>