Skip to content

Commit b349ef7

Browse files
committed
Updated README.md
Updated README.md with preserve authentication token example.
1 parent 12c41eb commit b349ef7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,42 @@ print_r($message);
488488
?>
489489
```
490490

491+
### Send a single SMS while preserving authentication token (for multiple concurrent executions)
492+
493+
```php
494+
<?php
495+
496+
//Your account username and password
497+
$username = "";
498+
$password = "";
499+
500+
//Preserve an access_token if it already exists and it is not expired. Used when multiple nodes use the same account to access the API.
501+
$preserve=true;
502+
503+
//Endpoint Options:
504+
// APIClient::API_ENDPOINT - REST API (SMS, OTP, HLR) - Default
505+
// APIClient::SMPP_API_1_ENDPOINT - Asynchronous SMS API (SMS)
506+
// APIClient::SMPP_API_2_ENDPOINT - Asynchronous SMS API (SMS) - Alternative
507+
$endpoint = MobiWeb\Rest\Client::SMPP_API_1_ENDPOINT;
508+
509+
$client = new MobiWeb\Rest\Client($username, $password, $endpoint, $preserve);
510+
511+
//Submit message
512+
$message = $client->broadcast(
513+
[[
514+
"from" => "HelloWorld", //The sender displayed upon the SMS arrival. Can be composed of 2-11 alphanumeric characters (A-z,0-9, ,-,.) or 14 numeric characters (0-9). Special characters are not allowed.
515+
"to" => ["44xxxxxxxxxx"], //The full international number(s) of the recipient(s) in international E.164 format https://en.wikipedia.org/wiki/E.164.
516+
"message" => "Hello from MobiWeb!" //The text of the SMS message. If all characters in the message belong to the 3GPP GSM 7-bit GSM 03.38 ASCII character table https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_/_GSM_03.38, you can send up to 160 characters in a single SMS. You can send longer messages automatically by setting message parameter with your preffered text. In long SMS (multi-part SMS), each SMS part can be up to 153 characters. Each part costs as 1 SMS. If one or more characters in the message belong to the 16-bit Unicode / UCS-2 character table https://en.wikipedia.org/wiki/UTF-16, because of the increased memory requirement for each character, you can send up to 70 characters in a single SMS. In long SMS (multi-part SMS), each SMS part can be up to 67 characters. Each part costs as 1 SMS.
517+
518+
]]
519+
);
520+
521+
//Print message
522+
print_r($message);
523+
524+
?>
525+
```
526+
491527
### Send multiple SMS
492528

493529
```php

0 commit comments

Comments
 (0)