Alles Wichtige rund um Send SMS
Finde alle wichtigen Infos zur Send SMS API: von Leistungsbeschreibungen über Preislisten bis hin zu Code-Beispielen und relevanten Links zur Doku oder Beispiel-Applikationen.

Send SMS API ausprobieren

Bitte melde Dich an um SMS senden zu können


Wie funktioniert das?

  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 user name
  14. $username = "login";
  15. // Telekom 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";