I'm trying to get a version of Twilio-PHP code working. I've hosted it and the Twilio library here.
An error is thrown on this line:
$response = $client->account->sms_messages->create($from,$number,$text);
It throws the error:
"Call to member function create() on a non-object"
I define $from
, $number
, and $text
above as strings. The first two are verified Twilio $text="Hi";
. The syntax of the call is cut and paste from the Quickstart section of that GitHub and so it is more likely that I am not using the code properly.
There wasn't enough explanation in this question for me to understand the error message.
Actual Code
<?php
require './twilio-php/Services/Twilio.php';
$AccountSid = X;
$AuthToken =X;
$client = new Services_Twilio($AccountSid,$AuthToken);
$number = "1111";
$text = "This is a test";
$from = "2222";
$response = $client->account->sms_smessages->create($from,$number,$text);
?>
Note: I replaced the real numbers and authorization tokens with dummies.