Twilio PHP API Librarie: Warning: file_get_contents (): SSL operation failed with code 1

I installed the official Twilio PHP API Librarie via composer ("twilio / sdk": "~ 3.12").

When I try to use the API (send SMS for example) using test credentials, I get an error:

Warning: file_get_contents (): SSL operation failed with code 1. OpenSSL Error messages: error: 14090086: SSL routines: SSL3_GET_SERVER_CERTIFICATE: certificate verification failed..vendor / twilio / sdk / Services / Twilio / HttpStream.php line 62

If I try to send SMS to the terminal using curl, everything is fine.

How can I fix this without editing the Twilio PHP API library code?

+3


source to share


2 answers


Twilio developer evangelist is here.

I found this happened when you don't have PHP curl bindings. Try to recompile PHP with curl or install php5-curl package .



Let me know if it helps at all.

+9


source


This is how I fixed the problem. Change Twilio.php

, right above verify_peer

, add this line:

'cafile' => '/etc/ssl/certs/ca-certificates.crt',

      



This fix worked for me on Ubuntu 14.04 running PHP 5.5.9.

+2


source







All Articles