note 71326 modified in ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:16:45 +0000 |
| Subject: | note 71326 modified in ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155218@lists.php.net to get a copy of this message | ||
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.
--was--
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():
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:
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($AuthNetConn, 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.
http://php.net/manual/en/ref.curl.php