Tongi
Tongi

Reputation: 51

Laravel 4.2 sending a sms to mobile phone with twilio

I am trying to send a message from my laravel app with trial but am getting an error which I cannot configure. Any ideas?

This is my controller

 public function postSend() {
    if (Input::has("message")) {
        $sid = "AC792b6fee2aabbe52be63f22235b15ae5";
        $token = "3c7fb18d1a615ac3f76b0b37f13d7177";

        $http = new Services_Twilio_TinyHttp(
            'https://api.twilio.com',
            array('curlopts' => array(
                CURLOPT_SSL_VERIFYPEER => true,
                CURLOPT_SSL_VERIFYHOST => 2,
            ))
        );
        $client = new Services_Twilio($sid, $token, $http);
        $message = $client -> account -> messages -> sendMessage('+256 758 029980',
            '+256 788 207331',
            Input::get("message"));
        return Redirect::route('booking')
            ->with(
                array(
                    'success' => 'Message Send Successfully Message SID ::' . $message -> sid
                )
            );

    }
    else {
        return Redirect::back()
            ->withErrors('did not send the message');

    }

and the error I am getting is

 Services_Twilio_TinyHttpException (E_ERROR)

SSL certificate problem: self signed certificate in certificate chain

Upvotes: 0

Views: 449

Answers (1)

Jordan Plamondon
Jordan Plamondon

Reputation: 345

What is your version of libcurl?
On this link, (making sure you have an up to date version of the helper library) it says that you have to Upgrade your version of libcurl:
https://github.com/twilio/twilio-php/blob/master/docs/faq.rst#ssl-validation-exceptions

If it does not work, you can try to Edit TinyHttp.php
by adding: CURLOPT_SSL_VERIFYPEER => FALSE, at $opts array
but it's not the optimal solution.

Upvotes: 1

Related Questions