note 71326 deleted from function.curl-setopt by datibbaw
| From: | datibbaw@php.net | Date: | Tue, 18 Mar 2014 02:34:30 +0000 |
| Subject: | note 71326 deleted from function.curl-setopt by datibbaw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198951@lists.php.net to get a copy of this message | ||
Note Submitter: pyroevi at yahoo dot com
----
I was working on using php to interface with an authorize.net gateway, and I ran into a problem with
certificates using curl to talk the https:// url.
curl_error() told me "SSL certificate problem, verify that the CA cert is OK."
I googled it and found the same "solution" over and over again: bypass verification by
adding this line after curl_init():
<?php
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, false);
?>
This worked great, but I was required to verify, so here's what I did. Add the following lines:
<?php
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($connection, CURLOPT_CAINFO, "path:/ca-bundle.crt");
?>
with "path:/ca-bundle.crt" being the path to that certificate file. You can get this file
by downloading the curl package (http://curl.haxx.se/download.html) and looking for it in the lib
folder.
Feel free to email me.