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 (1 & 2) and a reference here on SO but the scripts don't seem to work for me.
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.
This is the script I have and all it does is sit there waiting for something to happen (I get no errors).
$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);
I just need to figure out what I'm doing wrong here. Thanks!
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 this article 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.