Learn how to use the bdbulksms API effectively. This manual covers everything you need to send SMS in Bangladesh.
URL: http://api.greenweb.com.bd/g_api.php (html output)
URL: http://api.greenweb.com.bd/g_api.php?json (JSON)
Check Balance: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&balance
Check Balance (JSON Format): http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&balance&json
Check SMS Rate: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&rate
Total Sent SMS Stats Using Token: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&tokensms
Total Sent SMS Stats From Your Account: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&totalsms
Total Sent SMS Monthly (within current month) Stats From Your Account: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&monthlysms
Total Sent SMS Monthly (within current month) Stats From The token: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&tokenmonthlysms
Total Sent SMS in Any Month (Write month in m-Y format. Ex: 01-2024) From Your Account: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&monthlysms=08-2025
Total Sent SMS in Any Month (Write month in m-Y format. Ex: 01-2024) From Specific Token: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&tokenmonthlysms=08-2025
SMS Validity: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&expiry
Everything Together: http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&expiry&rate&tokensms&totalsms&monthlysms&tokenmonthlysms
Everything Together (json): http://api.greenweb.com.bd/g_api.php?token=yourtokencodehere&expiry&rate&tokensms&totalsms&monthlysms&tokenmonthlysms&json
<form action="http://api.greenweb.com.bd/api.php" method="post">
<input type="text" name="token" placeholder="token" />
<input type="text" name="to" placeholder="+8801xxxxxxxxx,+8801xxxxxxxxx" />
<textarea class="span11" name="message" id="message" style="position: relative; left: 4%;" ></textarea>
<button type="submit" name="submit" class="btn btn-success btn-large">Send Message</button>
</form>
Get Method:
http://api.greenweb.com.bd/api.php?token=tokencodehere&to=017xxxxxxxx,015xxxxxxxx&message=my+message+is+here
If you're using GET METHOD you have to URL ENCODE message text. For URL Encoding you can use rawurlencode() in php । if its javascript you can use encodeURI()
JSON Data Format:
{
"smsdata": [
{
"to": "016xxxxxxxx",
"message": "string"
},
{
"to": "016xxxxxxxx",
"message": "test"
}
],
"token": "1234567890123456789"
}
<form action="http://api.greenweb.com.bd/api.php" method="post">
<input type="text" name="token" placeholder="token" />
<input type="text" name="to" placeholder="+8801xxxxxxxxx,+8801xxxxxxxxx" />
<textarea class="span11" name="message" id="message" style="position: relative; left: 4%;" ></textarea>
<button type="submit" name="submit" class="btn btn-success btn-large">Send Message</button>
</form>
By Default Our API Retun Line by Line seperated html response । You can take each line in array and match Ok: for success and for the error you can match Error: word । For example:
Ok: SMS Sent Successfully To +8801xxxxxxxxx
Error: +8801xxxxxxxxx Invalid Number !
You got the above response now take it in an array
$smsresultarray = preg_split('/\r\n|\r|\n/', $smsresult);
now process the array
foreach($smsresultarray as $result) {
$status = mb_substr($result, 0, 2);
if ($status == 'Ok') {
//sms successfully sent do whatever you want
echo $result;
} else {
//failed to sent do whatever you want
echo $result;
}
}
You can get JSON Response by input &json at the end of the url like this http://api.greenweb.com.bd/api.php?json
For example :
<?php
$to = "017xxxxxxx,+88016xxxxxxx";
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$message = "Test SMS using API";
//Put &json in here ->
$url = "http://api.greenweb.com.bd/api.php?json";
$data= array(
'to'=>"$to",
'message'=>"$message",
'token'=>"$token",
'json'=>"1",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
Now you'll get output like this :
[
{
"to": "+8801xxxxxxx",
"message": "test sms",
"status": "SENT",
"statusmsg": "SMS Sent Successfully To +8801xxxxxxx"
},
{
"to": "+8801xxxxxxx",
"message": "test sms",
"status": "FAILED",
"statusmsg": "+8801xxxxxxx Invalid Number"
}
]
How to process it in php?
$smsresult = json_decode($smsresult);
foreach ($smsresult as $result) {
if ($result->status == "SENT") {
echo "SMS sent successfully";
echo $result->to;
echo $result->status;
echo $result->statusmsg;
} else {
echo "Failed to send";
echo $result->to;
echo $result->status;
echo $result->statusmsg;
}
}
<?php
$to = "017xxxxxxx,+88016xxxxxxx";
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$message = "Test SMS using API";
$url = "http://api.greenweb.com.bd/api.php?json";
$data= array(
'to'=>"$to",
'message'=>"$message",
'token'=>"$token"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
For sending sms you need three data. 1. to (it is the receiver phone number), 2. message (it is the text you want to send) 3. token (you have to generate it from the panel, it will works as a key)
<?php
//Take Data from your database in your own way in a loop
$dblink = mysqli_connect("localhost", "dbusername", "dbpassword", "dbname");
/* If connection fails throw an error */
if (mysqli_connect_errno()) {
echo "Could not connect to database: Error: ".mysqli_connect_error();
exit();
}
$sqlquery = "SELECT number FROM table_name";
if ($result = mysqli_query($dblink, $sqlquery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$number = $row["number"];
$to = "$number,$to";
}
}
// We got all numbers in a string called $to now we will send sms
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$message = "Test SMS using API";
$url = "http://api.greenweb.com.bd/api.php";
$data= array(
'to'=>"$to",
'message'=>"$message",
'token'=>"$token"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
{
"smsdata": [
{
"to": "+8801xxxxxxx",
"message": "বাংলা ম্যাসেজ"
},
{
"to": "01xxxxxxx",
"message": "test"
}
],
"token": "replace_it_with_your_token_code"
}
test this code : https://reqbin.com/bwdocgdo
php sample code using json data:
<?php
$url = "https://api.bdbulksms.net/api.php?json";
$data = json_encode([
'token' => 'Replace_it_with_your_token',
'smsdata' => [
[
'to' => '+8801xxxxxxx',
'message' => 'বাংলা ম্যাসেজ',
],
[
'to' => '01xxxxxxx',
'message' => 'English sms test',
],
],
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
//response
echo $response;
?>
Alternative Method:
JSON Format: [{"to":"+8801xxxxxxxxx","message":"firstsmstest"},{"to":"018xxxxxxxxxxx","message":"secondmesssagehere"}]
(Your message must be urlencoded or rawurldecoded)
Live preview:http://jsfiddle.net/greenwebbd/hp2Lr460/embedded/result
Code:http://jsfiddle.net/greenwebbd/hp2Lr460/embedded/html
Parameters:
token = Generate from above link
smsdata = valid json data containing to and message text
Sample PHP Code:
<?php
$url = "https://api.greenweb.com.bd/api.php?json";
$data = [
"token" => "your token here",
"smsdata" => json_encode(
[
[
"to" => "88017xxxxxxxx",
"message" => "testsms one"
],
[
"to" => "88018xxxxxxxx",
"message" => "test sms two"
]
],
JSON_UNESCAPED_UNICODE)
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
//response
echo $response;
?>
Using Database and php:
<?php
$json_smsdata = [];
// Take Data from database using loop
$dblink = mysqli_connect("localhost", "dbusername", "dbpassword", "dbname");
/* If connection fails throw an error */
if (mysqli_connect_errno()) {
echo "Could not connect to database: Error: ".mysqli_connect_error();
exit();
}
//you can max set limit here (if you want)
$sqlquery = "SELECT name,number FROM table_name LIMIT 1000";
if ($result = mysqli_query($dblink, $sqlquery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$name = $row["name"];
$number = $row["number"];
// We got name and number now we will format our text
$message = rawurlencode("Hi $name,
your message
Regards
bdsms.net
");
$json_smsdata[]= ['to'=>$number,'message'=>$message];
}
}
$smsdata = json_encode($json_smsdata);
// $smsdata containts our json encoded data
//now send it
$token = "yourtokenhere_xxxxxxxxxxxxxxxxxxx";
$smsdata = $smsdata;
$url = "https://api.greenweb.com.bd/api.php";
$data= array(
'smsdata'=>"$smsdata",
'token'=>"$token"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
<?php
// Start the session
session_start();
//give your token here
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
function GetRealUserIp($default = NULL, $filter_options = 12582912) {
$HTTP_CLIENT_IP = "";
$HTTP_X_FORWARDED_FOR = $_SERVER["HTTP_X_FORWARDED_FOR"];
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $HTTP_CLIENT_IP = $_SERVER['HTTP_CLIENT_IP']; }
$HTTP_CF_CONNECTING_IP = $_SERVER["HTTP_CF_CONNECTING_IP"];
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
$all_ips = explode(",", "$HTTP_X_FORWARDED_FOR,$HTTP_CLIENT_IP,$HTTP_CF_CONNECTING_IP,$REMOTE_ADDR");
foreach ($all_ips as $ip) {
if ($ip = filter_var($ip, FILTER_VALIDATE_IP, $filter_options))
break;
}
return $ip?$ip:$default;
}
$ip = GetRealUserIp();
echo "<center>";
if (isset($_POST['code'])) {
//csrf protection
if (($_SESSION["csrftoken"]) != ($_POST['csrftoken'])) {
echo "OTP Abuse detected ! Please refresh the page and try again !";
exit();
}
//check for matching
if ($_SESSION["otp"] == $_POST['code']) {
echo "You have verified your mobile number successfully</br>";
$_SESSION['verified'] = "1";
//Reset otp request limit
$_SESSION[$ip] = "0";
} else {
echo "You have entered wrong otp code, try again later.";
}
}
if ((isset($_SESSION['verified'])) AND ($_SESSION['verified'] == '1')) {
//you can post your page content here or below the page.
} else {
if(isset($_POST['otp'])) {
//check csrf for protection
if (($_SESSION["csrftoken"]) != ($_POST['csrftoken'])) {
echo "OTP Abuse detected ! Please refresh the page and try again !";
exit();
} else {
$csrftoken = $_POST['csrftoken'];
}
// Check how many times an otp requested from an ip and take precautions if its high
if ($_SESSION[$ip] > "5") {
echo "You're allowed to request otp for 5 times per session ! Your request is blocked.";
exit();
}
// Generate Random 5 digits otp
$code = substr(md5(mt_rand()), 0, 5);
//send otp to mobile via api
$to = preg_replace("|[^0-9 \+\/]|", '', $_REQUEST['number']);
//message text
$message = "(YourCompanyName) আপনার ওটিপি কোড: $code
@youdomainname, #$code";
$url = "http://api.greenweb.com.bd/api.php";
$data= array(
'to'=>"$to",
'message'=>"$message",
'token'=>"$token"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
$result = mb_substr($smsresult, 0, 2);
if ($result == 'Ok') {
//Per ip OTP Limit
if (isset($_SESSION[$ip])) {
$_SESSION[$ip] = ($_SESSION[$ip] + 1);
} else {
$_SESSION[$ip] = "1";
}
echo "Otp code is successfully sent to your mobile, you may have to wait upto 5 min to receive your code";
// save otp code on the session
$_SESSION["otp"] = $code;
//show code input form
echo "
Enter the verification code below </br>
<form action='' method='POST'>
<input type='text' name='code'>
<input type='hidden' name='csrftoken' value='$csrftoken' >
<button type='submit' value='code' name='otp'>Verify</button>
</form>";
exit();
} else {
echo "Failed to send Otp. Please try again after sometime";
exit();
}
} else {
//generate csrf token it's require to protect your otp sms form from the abusers
$csrftoken = substr(md5(mt_rand()), 0, 15);
$_SESSION["csrftoken"] = $csrftoken;
echo "
Enter your mobile number to receive OTP code </br>
<form action='' method='POST'>
<input type='text' name='number'>
<input type='hidden' name='csrftoken' value='$csrftoken' >
<button type='submit' value='otp' name='otp'>Get Otp</button>
</form>";
exit();
}
//it's not required but for extra safety
exit();
}
?>
function myFunction(sms){
var to = "016150505xx";
var row = 1; //grab cell data from row 1
var col = 1; //grab cell data from column 1
var gwcelldata = SpreadsheetApp.getActiveSheet().getRange(row, col).getValue(); //get active sheet data
var sms = encodeURI("Test Message"+gwcelldata);
var url = "https://sms.greenweb.com.bd/api.php?token=yourtokenhere&to="+to+"&message="+sms+"&submit";
var response = UrlFetchApp.fetch(url);
Logger.log(response);
}
For more information check: https://developers.google.com/apps-script/reference/spreadsheet/sheet
<%
apiurl = "http://api.greenweb.com.bd/api.php?"
message = "Hello World"
message = Server.urlencode(message)
mobile = "017xxxxx,016xxxxx"
'11 digit number
url = apiurl & "token=" & token & "&to=" & mobile & "&message=" & message
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
'use GET for get method
xmlhttp.send ""
msg = xmlhttp.responseText
response.write(msg)
set xmlhttp = nothing
%>
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace GreenwebBDAPI{
class Program{
static void Main(string[] args){
string result = "";
WebRequest request = null;
HttpWebResponse response = null;
try{
String to = "016xxxxxxxx,017xxxxx"; //Recipient Phone Number multiple number must be separated by comma
String token = "entertokencodehere"; //generate token from the control panel
String message = System.Uri.EscapeUriString("my messages"); //do not use single quotation (') in the message to avoid forbidden result
String url = "http://api.greenweb.com.bd/api.php?token=" + token + "&to=" + to + "&message=" + message;
request = WebRequest.Create(url);
// Send the 'HttpWebRequest' and wait for response.
response = (HttpWebResponse) request.GetResponse();
Stream stream = response.GetResponseStream();
Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
StreamReader reader = new
System.IO.StreamReader(stream, ec);
result = reader.ReadToEnd();
Console.WriteLine(result);
reader.Close();
stream.Close();
} catch (Exception exp){
Console.WriteLine(exp.ToString());
} finally {
if (response != null)
response.Close();
}
}
}
}
using System.Net.Http;
Setup:
It is recommended to instantiate one HttpClient for your application's lifetime and share it.
private static readonly HttpClient client = new HttpClient();
POST:
var values = new Dictionary
{
{ "token", "yourtokenhere" },
{ "to", "016xxxxxxxxx" },
{ "message", "test" }
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://api.greenweb.com.bd/api.php?", content);
var responseString = await response.Content.ReadAsStringAsync();
Newer library sporting a fluent API and testing helpers. HttpClient under the hood. Portable. Available via NuGet.
using Flurl.Http;
POST
var responseString = await "http://api.greenweb.com.bd/api.php?"
.PostUrlEncodedAsync(new { token = "yourtokencodehere", to = "015xxxxxxx", message = "my message" })
.ReceiveString();
String token = "YourTokenCodeHere";
//Single or Multiple mobiles numbers separated by comma
String to = "017xxxxxxxxx,016xxxxxxx";
//Your message to send, Add URL encoding here.
String textmessage = "my message is here";
URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;
//encode the message content
String encoded_message=URLEncoder.encode(textmessage);
String apiUrl="http://api.greenweb.com.bd/api.php?";
StringBuilder sgcPostContent= new StringBuilder(apiUrl);
sgcPostContent.append("token="+token);
sgcPostContent.append("&to="+to);
sgcPostContent.append("&message="+encoded_message);
apiUrl = sgcPostContent.toString();
try
{
//prepare connection
myURL = new URL(apiUrl);
myURLConnection = myURL.openConnection();
myURLConnection.connect();
reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
//read the output
String output;
while ((output = reader.readLine()) != null)
//print output
Log.d("OUTPUT", ""+output);
//Close connection
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
Imports System.Web
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Resources
Public Class greenwebApi
Public Function greenwebApi()
Dim token = "YourTokenCodeHere"
Dim message = "Hello World"
Dim mobile = "017xxxxxxxx"
Dim url As String = "http://api.greenweb.com.bd/api.php?"
Dim strPost As String
strPost = url + "token=" + token _
+ "&to=" + mobile _
+ "&message=" + WebUtility.UrlEncode(message)
Dim request As WebRequest = WebRequest.Create(strPost)
request.Method = "POST"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPost)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
Console.ReadLine()
reader.Close()
dataStream.Close()
response.Close()
If responseFromServer.Length > 0 Then
Return responseFromServer
Else
Return CType(response, HttpWebResponse).StatusDescription
End If
End Function
End Class
Private Sub Command1_Click()
Dim DataToSend As String
Dim objXML As Object
Dim message As String
Dim token As String
Dim smsto As String
Dim URL As String
'Set Your Token Here. Generate it from the control panel
token = "xxxxxxxxxxxxxxxxxxxx"
'set/declare your recipient number here
smsto = "01xxxxxxxxxxx"
'Set your Message here
message = URLEncode(" Hello World This is Greenweb BD ")
' do not change anything below
URL = "http://api.greenweb.com.bd/api.php?"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL, False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXML.send "token=" + token + "&to=" + smsto + "&message=" + message
'response box start, You can remove the response code from here
If Len(objXML.responseText) > 0 Then
MsgBox objXML.responseText
End If
'response end remove upto this if you want
End Sub
Function URLEncode(ByVal Text As String) As String
Dim i As Integer
Dim acode As Integer
Dim char As String
URLEncode = Text
For i = Len(URLEncode) To 1 Step -1
acode = Asc(Mid$(URLEncode, i, 1))
Select Case acode
Case 48 To 57, 65 To 90, 97 To 122
' don't touch alphanumeric chars
Case 32
' replace space with "+"
Mid$(URLEncode, i, 1) = "+"
Case Else
' replace punctuation chars with "%hex"
URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
(URLEncode, i + 1)
End Select
Next
End Function
DECLARE
smsto varchar(5000) := :new.to;
message varchar(5000) := Utl_Url.escape(:new.message, TRUE);
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
value VARCHAR2(5024);
v_url VARCHAR2(200) := 'http://api.greenweb.com.bd/api.php';
v_param VARCHAR2(5000) := 'token=yourtoken&to=' || smsto || '&message=' || message || '';
v_param_length NUMBER := length(v_param);
BEGIN
req := UTL_HTTP.BEGIN_REQUEST (url=> v_url, method => 'POST');
UTL_HTTP.SET_HEADER (r => req,
name => 'Content-Type',
value => 'application/x-www-form-urlencoded');
UTL_HTTP.SET_HEADER (r => req,
name => 'Content-Length',
value => v_param_length);
UTL_HTTP.WRITE_TEXT (r => req,
data => v_param); resp := UTL_HTTP.GET_RESPONSE(req);
LOOP
UTL_HTTP.READ_LINE(resp, value, TRUE);
DBMS_OUTPUT.PUT_LINE(value);
END LOOP;
UTL_HTTP.END_RESPONSE(resp);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
UTL_HTTP.END_RESPONSE(resp);
END;
const axios = require('axios');
const greenwebsms = new URLSearchParams();
greenwebsms.append('token', 'yourtokenhere');
greenwebsms.append('to', '+88017xxxxxxx');
greenwebsms.append('message', 'test sms');
axios.post('http://api.greenweb.com.bd/api.php', greenwebsms).then(response => {
console.log(response.data);
});
Mehtod 2:
var http = require('http');
var querystring = require('querystring');
var postData = querystring.stringify({
token: 'your token code here',
to: '+88017xxxxxxxxx',
message: 'Test sms using API'
});
var options = {
hostname: 'api.greenweb.com.bd',
path: '/api.php',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': postData.length
}
};
var req = http.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY:', chunk);
});
res.on('end', function () {
});
});
req.on('error', function (e) {
console.log('Problem with request:', e.message);
});
req.write(postData);
req.end();
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new FormBody.Builder()
.add("token", "Input your token here")
.add("to", "+88017xxxxxxx")
.add("message", "Test sms using API")
.build();
Request postRequest = new Request.Builder()
.url("http://api.greenweb.com.bd/api.php")
.post(requestBody)
.build();
try {
Response response = client.newCall(postRequest).execute();
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
import requests
greenweburl = "http://api.greenweb.com.bd/api.php"
# your token code here
token = "XXXXXXXXXXXXXXXXX"
# sms receivers number here (separated by comma)
to = '+88017xxxxxxx,+88016xxxxxxxx'
data = {'token':"yourtokenhere",
'to':"+88017xxxxxxx,+88016xxxxxxxx",
'message':'test sms'}
responses = requests.post(url = greenweburl, data = data)
# response
response = responses.text
print(response)
Github BD Bulk SMS Repository 1 (Official): https://github.com/bdgreenweb/Laravel-sms-package-for-bdbulksms.net-SMS-API/
Github BD Bulk SMS Repository 2 (Unofficial): https://github.com/bdgreenweb/laravel-greenweb-sms