user1761583
user1761583

Reputation: 15

PHP Script to send SMS using Nexmo API

I am looking for a PHP script to send SMS using API's like Nexmo / Twillio etc.

Is there any PHP script that I use to send quick SMS messages using Nexmo API?

Upvotes: 0

Views: 9963

Answers (3)

JaimeToca
JaimeToca

Reputation: 46

Here is how you can send an sms :)

<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query([
    'api_key' => API_KEY,
    'api_secret' => API_SECRET,
    'to' => YOUR_NUMBER,
    'from' => NEXMO_NUMBER,
    'text' => 'Hello from Nexmo'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

API Documentation:

https://docs.nexmo.com/index.php/sms-api/send-message https://nexmo.github.io/Quickstarts/sms/send/

Upvotes: 1

Jun Dolor
Jun Dolor

Reputation: 639

I've used the Nexmo-PHP-Lib and was able to send an SMS to a mobile in Canada.

Upvotes: 0

Drew Shafer
Drew Shafer

Reputation: 4802

Nexmo lists two PHP libraries on their Pre-Built Libraries page. Are neither of those suitable?

Direct links to the two libraries Nexmo recommends:

Disclaimer - I've never used either of those libs, so I can't vouch for them.

Upvotes: 0

Related Questions