Created
December 3, 2013 16:45
-
-
Save enopanen/7772644 to your computer and use it in GitHub Desktop.
Text messaging with PHP using the TextMagic API
If for some reason, you need to send text messages to your clients cell phones, you should definitely have a look to TextMagic. They provide an easy API which allow you to send SMS to cell phones. Please note that the TextMagic service isn’t free. The example below shows how easy it is to send a SM…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include the TextMagic PHP lib | |
require('textmagic-sms-api-php/TextMagicAPI.php'); | |
// Set the username and password information | |
$username = 'myusername'; | |
$password = 'mypassword'; | |
// Create a new instance of TM | |
$router = new TextMagicAPI(array( | |
'username' => $username, | |
'password' => $password | |
)); | |
// Send a text message to '999-123-4567' | |
$result = $router->send('Wake up!', array(9991234567), true); | |
// result: Result is: Array ( [messages] => Array ( [19896128] => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment