Last active
July 4, 2021 08:16
-
-
Save PasanBhanu/48c1b90ae033816cc8326e9a06494653 to your computer and use it in GitHub Desktop.
Send SMS in PHP Application with Newsletters.lk SMS API Sri Lanka
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new \GuzzleHttp\Client(); | |
$url = "https://app.newsletters.lk/smsAPI?sendsms"; | |
$body['apikey'] = "YOUR_API_KEY"; | |
$body['apitoken'] = "YOUR_API_TOKEN"; | |
$body['type'] = "sms"; | |
$body['from'] = "My Sender ID"; | |
$body['to'] = "94711234567"; // Receiver Mobile No with Country Code | |
$body['text'] = "Your SMS"; | |
$body['route'] = 0; | |
$apiRequest = $client->post($url, ['form_params' => $body]); | |
$response = $apiRequest->getStatusCode(); | |
if ($response == 200){ | |
echo "Success"; | |
}else{ | |
echo "Error" | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sri Lankan SMS Gateway : https://newsletters.lk/
Guzzle QuickStart : http://docs.guzzlephp.org/en/stable/quickstart.html
For information about api please contact [email protected] and for above code @PasanBhanu