Ivijan Stefan Stipić Ivijan Stefan Stipić - 2 years ago 113
PHP Question

Twilio PHP: How to get outgoing SMS message SID

I use Twilio PHP API and try to record SID of outgoing SMS messages. How to get that info?

I don't have problem to send and recive SMS, that work fine but SID from outgoing messages I need to get messages directly from Twilio in another APP where I not save all message data in database.

$twilio = new Services_Twilio('SID','TOKEN');

$message = $twilio->account->messages->sendMessage(
$_POST['From'], // twilio phone number
$_POST['To'], // the number we are sending to - Any phone number
$_POST['Body'] // the sms body

Answer Source

Twilio developer evangelist here.

To get the message SID, all you need to do is read the value of $message->sid;.

So in your code you could do:

echo $message->sid;

If you wanna see all the variables returned by the request, you could do something like:


And this will give you information about all the variables returned.

Hope this help you

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download