php - cURL Failing Due To SSL Cert Rejection?


I am managing a beta website in which just a handful of trial users (3 out of 20) are unable to see the content on certain pages. Every users is using a different computer, on different networks. I've made sure that the 3 users have JavaScript enabled, but that does not solve the issue.

Delving deeper, it looks like the lack of content is due to a cURL call failing; for these users, it appears that curl_exec() is either failing, or returning no data, which in turn returns a null result, which is why they are not seeing any info. For these 3 users, this problem exists across 3 separate browsers (Chrome, IE, Firefox). I have verified that it is not due to any user settings, like user ID, since I can log into their accounts from multiple computers on different networks and get a response.

I think the culprit may be the way their machines/networks handle SSL certs. I am not well versed in SSL certs, so please excuse my ignorance or glaring mistakes in some areas. However, process of elimination leads me to believe that the website cert is being rejected by the networks/machines of these 3 users, and because of this the cURL call is failing. My questions are how can I verify that this is the case, what would be the cause if so, and how can I resolve the problem?

The website is built with PHP using the Zend frameowrk. Here is the relevant bit of code:

$ssl_cert = ZendGA_Global::getOption('curl_ssl_certificate');
$ssl_verify_peer = ZendGA_Global::getOption('curl_ssl_verify_peer');
$ssl_verify_host = ZendGA_Global::getOption('curl_ssl_verify_host');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// related to SSL cerificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $ssl_verify_host);
curl_setopt($ch, CURLOPT_CAINFO, $ssl_cert);

//execute post
$result = curl_exec($ch);

//close connection

Any help would be greatly appreciated.




I've figured out the issue: the cURL call was failing, but only because the URL was incorrect, which was a problem that originalted elsewhere. The URL is created from a base URL plus some parameters, but the function which grabs the base URL was grabbing hostname instead of domain name. Some users log in via VPN, which was causing the hostname to read slightly differently, which is why the URL was wrong. OK, that was rather convoluted, but the issues has been resolved. :-)

People are also looking for solutions to the problem: php - error connecting to MYSQL


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.