Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl certificate issue for localhost (127.0.0.1) #1

Closed
hackrat opened this issue Aug 27, 2014 · 6 comments
Closed

ssl certificate issue for localhost (127.0.0.1) #1

hackrat opened this issue Aug 27, 2014 · 6 comments

Comments

@hackrat
Copy link

hackrat commented Aug 27, 2014

I have tried this api library for php on localhost but getting below metioned error.

Fatal error: Uncaught exception 'Shippo_ApiConnectionError' with message 'Unexpected error communicating with Shippo. If this problem persists, let us know by contacting us through our contact form. (Network error [errno 77]: error setting certificate verify locations: CAfile: /opt/lampp/htdocs/magento/shippo/lib/Shippo/../cacert.pem CApath: none )' in /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiRequestor.php:282 Stack trace: #0 /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiRequestor.php(250): Shippo_ApiRequestor->handleCurlError(77, 'error setting c...') #1 /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiRequestor.php(176): Shippo_ApiRequestor->_curlRequest('post', 'https://api.gos...', Array, Array) #2 /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiRequestor.php(101): Shippo_ApiRequestor->_requestRaw('post', '/v1/customs/dec...', Array) #3 /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiResource.php(107): Shippo_ApiRequestor->request('post', '/v1/customs/dec...', Array) #4 /opt/lampp/htdocs/magento/shippo/lib/Sh in /opt/lampp/htdocs/magento/shippo/lib/Shippo/ApiRequestor.php on line 282

@hackrat
Copy link
Author

hackrat commented Aug 28, 2014

I have also tried below mentioned code to check API response. But I am getting a blank response.

"QUOTE", "name" => "Laura Behrens Wu", "company" => "Shippo", "street1" => "Clayton St.", "street_no" => "215", "street2" => "", "city" => "San Francisco", "state" => "CA", "zip" => "94117", "country" => "US", "phone" => "+1 555 341 9393", "email" => "laura@goshippo.com", "metadata" => "Customer ID 123456" ); ``` $_requestUrl = 'https://api.goshippo.com/v1/addresses/'; $userName = ''; $userPass = ''; $ch = curl_init($_requestUrl); $headers = array("Content-Type: application/json"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_USERPWD, $userName.':'.$userPass); curl_setopt($ch, CURLOPT_POSTFIELDS, Zend_Json::Encode($address)); $response = curl_exec($ch); Mage::log('shippo address response:'); Mage::log($response); ``` ?>

@pennadl
Copy link
Contributor

pennadl commented Jan 15, 2015

for localhost, a bruteforce workaround could be edit ApiRequestor.php and add these two lines

$curlOptions[CURLOPT_SSL_VERIFYHOST] = FALSE; 
$curlOptions[CURLOPT_SSL_VERIFYPEER] = FALSE;

after

$curlOptions[CURLOPT_FOLLOWLOCATION] = TRUE;

this will avoid to check for a valid certificate

@gplcart
Copy link

gplcart commented Jul 27, 2017

Things changed in 1.3.2
Add

$curlOptions[CURLOPT_SSL_VERIFYHOST] = false; 
$curlOptions[CURLOPT_SSL_VERIFYPEER] = false;

before

curl_setopt_array($curl, $curlOptions);

in CurlClient.php. Its around line 45

So bad we have to do it manually. Why not to disable the verifier automatically on test token?

@fgagne
Copy link

fgagne commented Aug 11, 2017

Another way around this issue is to download the cacert.pem hosted by curl and put it in lib directory where Shippo.php is located.

I have the problem on a Windows 7 computer.

@gplcart
Copy link

gplcart commented Aug 11, 2017

@francois-g Better yet, thanks.

robin-shippo pushed a commit that referenced this issue Mar 2, 2018
Add support for type Bearer authorization header
@Bit-Coin
Copy link

Bit-Coin commented Apr 12, 2018

we have to change following contents.
\Shippo\Shippo\CurlClient.php
go to line 44 and add these lines:

        $curlOptions[CURLOPT_SSL_VERIFYPEER] = false;
        $curlOptions[CURLOPT_SSL_VERIFYHOST] = false;

@jfriedr jfriedr closed this as completed Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants