You’ll need a TextMagic account and to download their PHP helper which they provide after signing up.
// 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 (  => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 )
Hi Chris, nice one. First of all thanks for such an informative post, but what if I’m using a framework for an instance CakePHP will this method work with it?
Rishi: The ‘correct’ way to do this with something like CakePHP or Zend would be to set up the TextMagic API as a third party library. But even just including it as Chris has demonstrated here would work, yes.
Framework or not, at the end of the day it’s still PHP. ;)
Thanks Vincent :-)
can i get the actual / full code of the send text message please…
All of your stuff is very impressive to say the least.. for texting you can also use MailUtils and SSMTP for free.
echo “AuthUser=$AuthUser” >> /etc/ssmtp/ssmtp.conf
echo “AuthPass=$AuthPass” >> /etc/ssmtp/ssmtp.conf
echo “FromLineOverride=YES” >> /etc/ssmtp/ssmtp.conf
echo “mailhub=smtp.gmail.com:587” >> /etc/ssmtp/ssmtp.conf
echo “useSTARTTLS=YES” >> /etc/ssmtp/ssmtp.conf
echo $message | mail -s “$SUBJECT” $NUMBER
This is awesome, we’ve used http://notifynotify.com to capture phone numbers and then use their platform to send them out.