Posted By

welancers on 08/28/12


Tagged

php text message sms


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

andreiguzga
DaR3Y
nei-si
nicklarosa


Send a Text Message using PHP


 / Published in: PHP
 

You'll need a TextMagic account and to download their PHP class file which they provide after signing up. http://www.textmagic.com/

  1. // Include the TextMagic PHP lib
  2. require('textmagic-sms-api-php/TextMagicAPI.php');
  3.  
  4. // Set the username and password information
  5. $username = 'myusername';
  6. $password = 'mypassword';
  7.  
  8. // Create a new instance of TM
  9. $router = new TextMagicAPI(array(
  10. 'username' => $username,
  11. 'password' => $password
  12. ));
  13.  
  14. // Send a text message to '999-123-4567'
  15. $result = $router->send('Wake up!', array(9991234567), true);
  16.  
  17. // result: Result is: Array ( [messages] => Array ( [19896128] => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 )

Report this snippet  

You need to login to post a comment.