Jump to content

Cannot access https using curl


kevingarnett2000

Recommended Posts

Hi,

 

I have compiled php with the following options for using curl

    --with-openssl=/usr/local/ssl

    --with-curl=/usr/local

 

and I have compiled curl with

    --with-ssl=/usr/local/ssl

 

For non https sites (see below), my codes works fine

$c = curl_init();

curl_setopt($c, CURLOPT_URL, "http://www.google.com");

$result = curl_exec($c); // it works

 

But when accessing https sites(see below), I got a "cannot connect to host" error vias the curl_error() call.

$c = curl_init();

curl_setopt($c, CURLOPT_URL, "https://somebank.com");

curl_setopt($c, CURLOPT_SSL_VERIFYHOST,  2);

curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE);

 

$result = curl_exec($c); // returns false

$error = curl_error(); // "connect connect to host"

 

Whats wrong? eh

Link to comment
https://forums.phpfreaks.com/topic/47208-cannot-access-https-using-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.