Tuesday, April 17, 2018

HTTP 401 Unable to create record Twillio PHP sdk 5.16 - development

HTTP 401 Unable to create record Twillio PHP sdk 5.16

I am using Twilio account for the sending SMS to users. I have installed the SDK by executing following command.

composer require twilio/sdk

and i am using the following code snippet to send message

public function sendSms($data) {
    // Your Account SID and Auth Token from twilio.com/console
    $account_sid = 'sid';
    $auth_token = 'token';
    $twilio_number = "number";
    $client = new Client($account_sid, $auth_token);
    return $client->messages->create(
               $data['phone'], array(
               'from' => $twilio_number,
               'body' => $data['message'],
             )
    );
}

according to twillio documentation message should be sent by this code on providing my valid credentials but i am getting the error

[HTTP 401] Unable to create record:
Authenticate85/var/www/art/api/vendor/twilio/sdk/Twilio/Version.php

I have done research on this issue but I got no guidance any clues?

Note: I have balance in my Twilio account



from Laravel Questions and Answers https://laravelquestions.com/php/http-401-unable-to-create-record-twillio-php-sdk-5-16/
via Lzo Media

No comments:

Post a Comment