Everything you need to know about Send SMS
Find out all the important info about Send SMS API: from service specifications, via price lists to code examples and relevant links to documentation or application examples.

Try the Send SMS API

You must login in to send SMS


How it works

  1. require_once (dirname(__FILE__). "/sdk/SendSmsStatusConstants.php");
  2. require_once (dirname(__FILE__). "/sdk/SendSmsClient.php");
  3.  
  4. // Recipients
  5. $recipients = "+49123123456789, 0123123456789";
  6. // Message
  7. $message = "Hello world!";
  8. // Senders name or phone (must be validated)
  9. $originator = "DevGarden";
  10. // Should the SMS be sent as flash SMS
  11. $flash = "false";
  12.  
  13. // Telekom Developer Center user name
  14. $username = "login";
  15. // Telekom Developer Center password
  16. $password = "password";
  17.  
  18. // Constructs the Telekom client using the user name and password.
  19. $client = new SendSmsClient("production", $username, $password);
  20. // The result of sending an SMS
  21. $response = null;
  22.  
  23. try {
  24. // Sends the SMS
  25. $response = $client->sendSms($recipients, $message, $originator, $flash, null);
  26. // Test, if the invocation of sendSms() was successful.
  27. if(!($response->getStatus()->getStatusConstant() == SendSmsStatusConstants::SUCCESS)) {
  28. $errorMessage = "The error code is: ".$response->getStatus()->getStatusCode();
  29. throw new Exception($errorMessage);
  30. }
  31. } catch(Exception $e) {
  32. print $e->getMessage()."\n";
  33. print $e->getTraceAsString();
  34. exit(1);
  35. }
  36. print "Your SMS has been sent successfully";