If you need to use HTTPS protocol with your curl, then here is the help for you. I'm giving you an example of Php code that will show you how to fetch the HTML content from HTTPS URL. You just need to enable the option for SSL certificate verification to curl. Thats all.
Below is the PHP/curl code that just browse the yahoo mail's login page which is a HTTPS link. When the content returned, it will print it on browser, which will appear as if it is Yahoo login page :)
Below is the PHP/curl code that just browse the yahoo mail's login page which is a HTTPS link. When the content returned, it will print it on browser, which will appear as if it is Yahoo login page :)
## HTTPS url that you are targeting.
$url = "https://login.yahoo.com/config/login?";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.23 (Windows NT 5.1; U; en)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
## Below two option will enable the HTTPS option.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
echo $result;
You can set other options timeout, Post values for Post method, etc. By the way, If you don't know how to configure Curl with PHP then follow the link http://icfun.blogspot.com/2008/04/configure-php-curl-with-apache.html
Comments
I spent 2 years developing a real estate datamining system that must update daily.
Today, the main site I scrape base data from trned on SSL.
Your https example was exactly what I needed and totally saved me!
Thank you very much!
This has helped me a lot!