Skip to content

Instantly share code, notes, and snippets.

@PasanBhanu
Last active July 4, 2021 08:16
Show Gist options
  • Save PasanBhanu/48c1b90ae033816cc8326e9a06494653 to your computer and use it in GitHub Desktop.
Save PasanBhanu/48c1b90ae033816cc8326e9a06494653 to your computer and use it in GitHub Desktop.
Send SMS in PHP Application with Newsletters.lk SMS API Sri Lanka
<?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"
}
?>
@PasanBhanu
Copy link
Author

PasanBhanu commented Sep 5, 2019

Newsletters.lk

Sri Lankan SMS Gateway : https://newsletters.lk/
Guzzle QuickStart : http://docs.guzzlephp.org/en/stable/quickstart.html

For information about api please contact support@newsletters.lk and for above code @PasanBhanu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment