Try out our Telekom Send SMS API for free and see how it works.

Try the Send SMS API

You must login in to send SMS


More Information

Telekom Send SMS APIThe Telekom Send SMS API allows your app to send text messages to mobile & landline networks. 

Go to Telekom Send SMS API

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";