Text magic sms API getting error on Godaddy shared hosting

Viewed 434

I am tryng to send SMS using Textmagic from godaddy using php. I have used the official git-hub page to get API https://github.com/textmagic/textmagic-rest-php

The above setups works fine from my local Ubuntu PC and able to send SMS, Where as when I host the API to Godaddy Windows shared hosting, and executed the same php code, I got following error.

[ERROR- ] error setting certificate verify locations: CAfile: c:\cgi\php56\curl-ca-bundle.crt CApath: none

What could be the reason.

Php version:5.6

2 Answers

I'm not sure if there is something GoDaddy configures that would not make this possible, but the best/most secure way to tackle this is to NOT use CURLOPT_SSL_VERIFYPEER = FALSE, but instead export the certificate chain to X.509. Then use CURLOPT_CAINFO to point to that certificate.

IE

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, "/path/to/the/certificate-you-exported.crt"); 

If GoDaddy does not let you do this, my suggestion would be to find another provider.

you can use :

 curl_setopt($link, CURLOPT_SSL_VERIFYPEER, FALSE);

but please be sure : you will lose the benefit of certification verification.

bypassing verification is not a good idea , ( may any one with you on the server get the URL and your api key )

if you have a root access on the server please enable permission for the user on the server verification folder :

chmod 755 /usr/share/ssl/certs 

this link can help for goddady : https://blog.hqcodeshop.fi/archives/304-Fixing-curl-with-Go-Daddy-Secure-Certificate-Authority-G2-CA-root.html

Related