āĻŦāĻžāϞā§āĻ āĻāϏāĻāĻŽāĻāϏ āĻāĻĒāĻŋāĻāĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠āĻŦāĻžāĻāϞāĻžāĻĻā§āĻļā§ āĻāϏāĻāĻŽāĻāϏ āĻĒā§āϰā§āϰāĻŖā§āϰ āĻĒāĻĻā§āϧāϤāĻŋ
URL: https://api.bdbulksms.net/g_api.php (āĻĒā§āϞā§āĻāύ āĻā§āĻā§āϏāĻ āĻāĻāĻāĻĒā§āĻ)
URL: https://api.bdbulksms.net/g_api.php?json (JSON āĻāĻāĻāĻĒā§āĻ)
āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&balance
āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻĻā§āĻāϤ⧠(JSON Format): https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&balance&json
SMS āϰā§āĻ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&rate
āĻā§āĻžāĻā§āύ āĻĨā§āĻā§ āĻŽā§āĻžāĻ āĻāϤāĻāĻŋ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&tokensms
āĻŽā§āϞ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āĻĨā§āĻā§ āĻŽā§āĻžāĻ āĻāϤāĻāĻŋ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&totalsms
āĻŽā§āϞ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āĻĨā§āĻā§ Current Month āĻ āĻāϤ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&monthlysms
āĻā§āĻžāĻā§āύ āĻĨā§āĻā§ Current Month āĻ āĻāϤ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&tokenmonthlysms
āĻŽā§āϞ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āĻĨā§āĻā§ XX Month āĻ āĻāϤ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤ⧠(XX āĻāϰ āĻāĻžā§āĻāĻžāϤ⧠āĻŽāĻžāϏ-āĻŦāĻāϰ ( āϝā§āĻŽāύ āĻāĻžāύā§ā§āĻžāϰ⧠⧍ā§Ļ⧍⧍ āĻāϰ āĻāύā§āϝ 01-2022) āĻĢāϰāĻŽā§āϝāĻžāĻā§ āĻŽāĻžāϏ āĻāϞā§āϞā§āϝā§āĻ āĻāϰāϤ⧠āĻšāĻŦā§): https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&monthlysms=05-2026
āĻā§āĻžāĻā§āύ āĻĨā§āĻā§ XX Month āĻ āĻāϤ SMS āĻĒāĻžāĻ āĻžāύā§āĻž āĻšā§ā§āĻā§ āĻĻā§āĻāϤ⧠(XX āĻāϰ āĻāĻžā§āĻāĻžāϤ⧠āĻŽāĻžāϏ-āĻŦāĻāϰ ( āϝā§āĻŽāύ āĻāĻžāύā§ā§āĻžāϰ⧠⧍ā§Ļ⧍⧍ āĻāϰ āĻāύā§āϝ 01-2022) āĻĢāϰāĻŽā§āϝāĻžāĻā§ āĻŽāĻžāϏ āĻāϞā§āϞā§āϝā§āĻ āĻāϰāϤ⧠āĻšāĻŦā§): https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&tokenmonthlysms=05-2026
SMS āĻāϰ āĻŽā§ā§āĻžāĻĻ āĻĻā§āĻāϤā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&expiry
āϏāĻŦ āĻāĻāϤā§āϰā§: https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&balance&expiry&rate&tokensms&totalsms&monthlysms&tokenmonthlysms
āϏāĻŦ āĻāĻāϤā§āϰ⧠(json): https://api.bdbulksms.net/g_api.php?token=yourtokencodehere&balance&expiry&rate&tokensms&totalsms&monthlysms&tokenmonthlysms&json
Check Balance and Others using PHP: https://reqbin.com/2odd1cmh
<form action="https://api.bdbulksms.net/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:(form-urlencoded)
https://api.bdbulksms.net/api.php?token=tokencodehere&to=017xxxxxxxx,015xxxxxxxx&message=my+message+is+here
Get Method āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻāĻžāĻāϞ⧠āĻ
āĻŦāĻļā§āϝāĻ āĻŽā§āϝāĻžāϏā§āĻ URL ENCODE āĻāϰ⧠āύāĻŋāĻŦā§āύ āĨ¤ URL Encode āĻāϰāϤ⧠rawurlencode() āĻĢāĻžāĻāĻļāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ āϝāĻĻāĻŋ āĻĒāĻŋāĻāĻāĻāĻĒāĻŋ āϏā§āĻā§āϰāĻŋāĻĒā§āĻ āĻšā§ āĨ¤ āϝāĻĻāĻŋ āĻāĻžāĻāĻžāϏā§āĻā§āϰāĻŋāĻĒā§āĻ āĻšā§ āϤāĻŦā§ encodeURI() āĻĢāĻžāĻāĻļāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ āĨ¤ āĻāϰ html āĻšāϞ⧠āϏā§āĻĒā§āϏāĻā§ + āĻĻāĻŋā§ā§ āϰāĻŋāĻĒā§āϞā§āϏ āĻāϰā§āύ āĨ¤
Curl Post Request (recommended):
curl -X POST "https://api.bdbulksms.net/api.php?json" -H "Content-Type: application/x-www-form-urlencoded" -d "to=016xxxxxxxx" -d "message=āĻā§āϏā§āĻ āĻāϏāĻāĻŽāĻāϏ" -d "token=1234567890123456789"
Test this code: https://reqbin.com/c-ts7tbfzh
JSON Format 1 (recommended):
{
"token": "replace_it_with_your_token_code",
"smsdata": [
{
"to": "+8801XXXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "+8801XXXXXXXXX",
"message": "test"
}
]
}
curl -X POST "https://api.bdbulksms.net/api.php?json" -H "Content-Type: application/json" -d '{
"token": "1234567890123456789",
"smsdata": [
{
"to": "88016XXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "88016XXXXXXXX",
"message": "test"
}
]
}'
Test this code: https://reqbin.com/c-frdkqeys
JSON Format 2:
(Token in URL https://api.bdbulksms.net/api.php?json&token=YOURTOKENCODE, body is plain array)
[
{
"to": "+8801XXXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "+8801XXXXXXXXX",
"message": "test"
}
]
curl -X POST "https://api.bdbulksms.net/api.php?json&token=1234567890123456789" -H "Content-Type: application/json" -d '[
{
"to": "88016XXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "88016XXXXXXXX",
"message": "test"
}
]'
Test this code: https://reqbin.com/c-mkh3ap3w
JSON Format for Curl Request Pattern 3
(Token in Header, body is plain array)
[
{
"to": "+8801XXXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "+8801XXXXXXXXX",
"message": "test"
}
]
curl -X POST "https://api.bdbulksms.net/api.php?json" -H "Content-Type: application/json" -H "token: 1234567890123456789" -d '[
{
"to": "88016XXXXXXXX",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "88016XXXXXXXX",
"message": "test"
}
]'
Test this code: https://reqbin.com/c-zzgquzdg
<form action="https://api.bdbulksms.net/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>
Default āĻāĻžāĻŦā§ āĻāĻŽāĻžāĻĻā§āϰ API āĻĒā§āϞā§āĻāύ āĻā§āĻā§āϏāĻ āϰāĻŋāϏāĻĒāύā§āϏ⧠āĻĻā§ā§ āϝāĻž āϞāĻžāĻāύ āĻŦāĻžāĻ āϞāĻžāĻāύ āϏā§āĻĒāĻžāϰā§āĻ āĻĨāĻžāĻā§ āĨ¤ āĻĒā§āϰāϤāĻŋ āϞāĻžāĻāύ āĻā§ āĻāĻĒāύāĻŋ array āϤ⧠āĻāύāĻāĻžāϰā§āĻ āĻāϰ⧠āϏāĻĢāϞ āĻŽā§āϝāĻžāϏā§āĻā§āϰ āĻāύā§āϝ Ok: āĻ
āĻĨāĻŦāĻž āĻĢā§āĻāϞ SMS āĻāϰ āĻāύā§āϝ Error: āĻļāĻŦā§āĻĻāĻāĻŋāϰ āϏāĻžāĻĨā§ āĻŽā§āϝāĻžāĻ āĻāϰāĻžāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤ āϝā§āĻŽāύ: āĻāĻāĻžāύ⧠php āϤ⧠āĻĒā§āϰā§āϏā§āϏ āĻāϰ⧠āĻĻā§āĻāĻžāύ⧠āĻšāϞā§
Default HTML/Text Output āύāĻŋāĻā§āϰ āĻŽāϤ āĻĢāϰāĻŽā§āϝāĻžāĻā§ āĻšāĻŦā§ :
Ok: SMS Sent Successfully To +8801749139144Error: +8801 Invalid Number !
Curl āĻāĻā§āϏāĻŋāĻāĻŋāĻāĻļāύā§āϰ āĻĒāϰ $smsresult āϏā§āĻā§āϰāĻŋāĻ āĻĒāĻžāĻŦā§āύ āĨ¤ āĻāĻŦāĻžāϰ āĻāĻāĻžāĻā§ array āϤ⧠āĻāύāĻāĻžāϰā§āĻ āĻāϰāĻŦā§ :
$smsresultarray = preg_split('/\r\n|\r|\n|<[^>]*>/', $smsresult);
āĻāĻŦāĻžāϰ 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;
}
}
Test this code: https://reqbin.com/5t9gu3g8
āĻāĻāĻžāĻŦā§ āĻā§āĻŦ āϏāĻšāĻā§āĻ āĻāĻĒāύāĻžāϰ āĻĒā§āϰā§āĻā§āϰāĻžāĻŽāĻŋāĻ āϞā§āϝāĻžāĻāĻā§ā§ā§āĻ āĻ
āύā§āϝāĻžā§ā§ array āϤ⧠āĻāύāĻāĻžāϰā§āĻ āĻāϰ⧠āϏāĻĢāϞ āĻŽā§āϝāĻžāϏā§āĻā§āϰ āĻāύā§āϝ Ok: āĻ
āĻĨāĻŦāĻž āĻĢā§āĻāϞāĻĄ SMS āĻāϰ āĻāύā§āϝ Error: āĻļāĻŦā§āĻĻāĻāĻŋāϰ āϏāĻžāĻĨā§ āĻŽā§āϝāĻžāĻ āĻāϰāĻžāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤
āϤāĻŦā§ āĻāĻĒāύāĻŋ āĻāĻžāĻāϞ⧠JSON āĻĢāϰāĻŽā§āϝāĻžāĻā§āĻ āϰāĻŋāϏāĻĒāύā§āϏ āĻĒā§āϰāϏā§āϏ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤ JSON āĻĢāϰāĻŽā§āϝāĻžāĻā§ āϰāĻŋāϏāĻĒāύā§āϏ āĻĒā§āϤ⧠API url āĻāϰ āĻļā§āώ⧠&json āĻĻāĻŋāϤ⧠āĻšāĻŦā§ āĨ¤
$url = "https://api.bdbulksms.net/api.php?json";
JSON Output āύāĻŋāĻā§āϰ āĻŽāϤ āĻĢāϰāĻŽā§āϝāĻžāĻā§ āĻšāĻŦā§ :
[
{
"to": "+8801xxxxxxx",
"message": "test sms",
"status": "SENT",
"statusmsg": "SMS Sent Successfully To +8801xxxxxxx"
},
{
"to": "+8801xxxxxxx",
"message": "test sms",
"status": "FAILED",
"statusmsg": "+8801xxxxxxx Invalid Number"
}
]
PHP āϤ⧠āĻāĻ $smsresult āϏā§āĻā§āϰāĻŋāĻ āĻ āĻĨāĻžāĻāĻž json āĻāĻāĻāĻĒā§āĻ āĻĒā§āϰā§āĻžāϏā§āϏ āĻāϰāĻž āϝāĻžāĻŦā§ āύāĻŋāĻā§āϰ āĻĒāĻĻā§āϧāϤāĻŋāϤā§
$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;
}
}
Test this code: https://reqbin.com/lttdy1eb
<?php
$to = "017xxxxxxx,+88016xxxxxxx";
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$message = "Test SMS using API";
$url = "https://api.bdbulksms.net/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);
?>
Test this code: https://reqbin.com/p79k1pl7
āĻŽā§āϞāϤ āĻĻā§āĻāĻāĻŋ āĻĄā§āĻāĻž āϞāĻžāĻāĻŦā§ āĻāĻĒāύāĻžāϰ āϏāĻžāĻāĻ āĻĨā§āĻā§ āĻāϰ āĻāĻāĻāĻŋ āĻĒāĻžāĻā§āĻž āϝāĻžāĻŦā§ āĻāĻŽāĻžāĻĻā§āϰ āĻāύā§āĻā§āϰā§āĻžāϞ āĻĒā§āϝāĻžāύā§āϞ āĻĨā§āĻā§ āĨ¤ āĻĒā§āϰāĻĨāĻŽā§ āĻāĻĒāύāĻžāϰ āϏāĻžāĻāĻ āĻĨā§āĻā§ $to (āϝāĻžāĻā§ SMS āĻĻāĻŋāϤ⧠āĻāĻžāύ) āĻāĻŦāĻ āĻŽā§āϝāĻžāϏā§āĻā§ āϝāĻž āĻĻāĻŋāϤ⧠āĻāĻžāύ āϤāĻž $message āĻāĻžāϰāĻŋā§ā§āϝāĻžāĻŦāϞ⧠āύāĻŋā§ā§ āĻāϏā§āύ āĨ¤ āĻāϰāĻĒāϰ āĻā§āĻžāĻā§āύ āĻā§āĻžāĻĄ āĻāĻŽāĻžāĻĻā§āϰ āĻāύā§āĻā§āϰā§āĻžāϞ āĻĒā§āϝāĻžāύā§āϞ āĻĨā§āĻā§ āĻā§āύāĻžāϰā§āĻ āĻāϰ⧠āύāĻŋāύāĨ¤ āĻāϰāĻĒāϰ āϏā§āύā§āĻĄ āĻāϰ āĻĢāĻžāĻāĻļāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ (CURL) āĨ¤ $smsresult āĻā§āϝāĻžāϰāĻŋā§ā§āĻŦāϞ⧠āϏā§āύā§āĻĄ āĻāϰāĻž āĻŽā§āϝāĻžāϏā§āĻā§āϰ āϰā§āĻāĻžāϞā§āĻ āĻāϏāĻŦā§ āĻāĻāĻž āĻāĻžāĻāϞ⧠āĻĄā§āĻāĻžāĻŦā§āĻā§ āϏā§āĻ āĻāĻŋāĻāĻŦāĻž āĻ
āύā§āϝ āĻāĻžāĻā§ āϞāĻžāĻāĻžāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤
<?php
$url = "https://api.bdbulksms.net/api.php?json";
$data = json_encode([
'token' => 'Replace_it_with_your_token',
'smsdata' => [
[
'to' => '+8801xxxxxxx', // With country code
'message' => 'āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ', // Bangla text
],
[
'to' => '01xxxxxxx', // Without country code
'message' => 'English sms test', // English text
],
],
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$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, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
Test this code: https://reqbin.com/ni0pwuip
āĻāĻāĻžāύ⧠āĻĒā§āĻžāϏā§āĻ āϰāĻŋāĻā§āĻžā§ā§āϏā§āĻā§ āĻāĻŽāϰāĻž āĻā§āĻžāĻā§āύ āĻāĻŦāĻ āĻŽā§āϝāĻžāϏā§āĻā§āϰ āĻĄā§āĻāĻž āĻĒā§āϰā§āϰāĻŖ āĻāϰāĻāĻŋāĨ¤ āĻāĻĒāύāĻŋ āϝā§āĻā§āĻžāύā§āĻž āϞā§āϝā§āĻĒ/āĻĄā§āĻāĻžāĻŦā§āĻ āĻĨā§āĻā§ āĻāĻāĻžāĻŦā§ āĻāϏāĻāĻŽāĻāϏ āĻĒā§āϰā§āϰāĻŖ āĻāϰāϤ⧠āĻĒāĻžāϰā§āύāĨ¤ āϝāĻž āĻāĻŽāϰāĻž āĻāϰāĻĒāϰā§āϰ āĻŽā§āύā§āϤ⧠āĻĻā§āĻāĻŋā§ā§āĻāĻŋāĨ¤
<?php
//āĻĒā§āϰāĻĨāĻŽā§ āĻāĻĒāύāĻžāϰ āϏā§āĻŦāĻŋāϧ⧠āĻŽāϤ āĻāϰ⧠āĻĄā§āĻāĻžāĻŦā§āĻ/Loop āĻšāϤ⧠āĻĄā§āĻāĻž āύāĻŋāύ āĻāĻāĻžāύ⧠mysqli āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠mysql/mariadb āĻĄā§āĻāĻžāĻŦā§āĻ āĻšāϤ⧠āĻĄā§āĻāĻž āύāĻŋā§ā§ āĻĻā§āĻāĻžāύā§āĻž āĻšāϞā§āĻž āĨ¤
$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)) { /////////while loop or foreach
$number = $row["number"];
$to = "$number,$to";
}
}
// āĻāĻŽāϰāĻž $to āϤ⧠āϏāĻŦ āύāĻžāĻŽā§āĻŦāĻžāϰ āĻāĻŽāĻž āϏā§āĻĒāĻžāϰā§āĻ āĻāϰāĻž āĻ
āĻŦāϏā§āĻĨāĻžā§ āĻĒā§ā§ā§āĻāĻŋ āĻāĻŦāĻžāϰ SMS āĻĒā§āϰā§āϰāύ āĻāϰā§āύ
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$message = "Test SMS using API";
$url = "https://api.bdbulksms.net/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);
?>
{
"smsdata": [
{
"to": "+8801xxxxxxx",
"message": "āĻŦāĻžāĻāϞāĻž āĻŽā§āϝāĻžāϏā§āĻ"
},
{
"to": "01xxxxxxx",
"message": "test"
}
],
"token": "replace_it_with_your_token_code"
}
Test this code: https://reqbin.com/bwdocgdo
āύāĻŋāĻā§āϰ php code āĻ āϏā§āϝāĻžāĻŽā§āĻĒāϞāĻāĻŋ āĻĻā§āĻā§āύ:
<?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;
?>
Test this code: https://reqbin.com/39w2u4kr
āĻāĻĒāύāĻŋ āϏāϰāĻžāϏāϰāĻŋ āĻāĻĒāϰā§āϰ āĻĢāϰāĻŽā§āϝāĻžāĻā§ Many to Many āĻĄā§āĻāĻž āϏā§āύā§āĻĄ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤
From Database/Any Loop using PHP mysqli:
<?php
$json_smsdata = [];
// āĻĒā§āϰāĻĨāĻŽā§ āĻāĻĒāύāĻžāϰ āϏā§āĻŦāĻŋāϧ⧠āĻŽāϤ āĻāϰ⧠loop āĻ āĻĄā§āĻāĻžāĻŦā§āĻ āĻšāϤ⧠āĻĄā§āĻāĻž āύāĻŋāύ āĻ
āĻĨāĻŦāĻž āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύā§āϰ āĻāύāĻĒā§āĻ āĻĨā§āĻā§ āĻĄā§āĻāĻž āύāĻŋāύ āĨ¤ āĻĄā§āĻāĻžāĻāĻŋ āĻāϰāĻĒāϰ loop āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠āĻĢāϰāĻŽā§āϝāĻžāĻ āĻāϰā§āύ: āĻāĻāĻžāύ⧠while loop āĻĻā§āĻāĻžāύā§āĻž āĻšā§ā§āĻā§ āĻāĻĒāύāĻžāϰāĻž foreach 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();
}
//āĻāĻžāĻāϞ⧠LIMIT āĻĻāĻŋā§ā§ ā§Ģā§Ļā§Ļ SMS āĻāĻāϏāĻžāĻĨā§ āĻĄā§āĻāĻžāĻŦā§āĻ āĻĨā§āĻā§ āϝāĻžāĻŦā§ āĻāĻŽāύ āϞāĻŋāĻŽāĻŋāĻ āĻāϰ⧠āύāĻŋāϤ⧠āĻĒāĻžāϰā§āύ āĨ¤
$sqlquery = "SELECT name,number FROM table_name";
if ($result = mysqli_query($dblink, $sqlquery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$name = $row["name"];
$number = $row["number"];
// āĻāĻŽāϰāĻž āĻāĻĒāϰ⧠loop āĻāϰ⧠āĻĄā§āĻāĻžāĻŦā§āĻ āĻĨā§āĻā§ name āĻāĻŦāĻ number āĻāϞāĻžāĻŽā§āϰ āĻĄā§āĻāĻž āύāĻŋāϞāĻžāĻŽ āĻāĻĒāύāĻŋ āĻĄā§āĻāĻžāĻŦā§āĻā§āϰ āĻĒāϰāĻŋāĻŦāϰā§āϤ⧠āϝā§āĻā§āĻžāύā§āĻž āϞā§āϝā§āĻĒ āĻĨā§āĻā§ āĻĄā§āĻāĻž āύāĻŋāϤ⧠āĻĒāĻžāϰāĻŦā§āύ, āĻāĻāύ dynamic āĻŽā§āϝāĻžāϏā§āĻ āϞāĻŋāĻā§āύ
$message = "Hi $name,
your message
Regards
bdbulksms.net";
$json_smsdata[]= ['to'=>$number,'message'=>$message];
}
}
$data = json_encode([
'token' => 'Replace_it_with_your_token',
'smsdata' => $json_smsdata,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// $data āĻšāϞā§āĻž āĻāĻŽāĻžāĻĻā§āϰ āĻāĻžāĻāĻāĻŋāϤ format āĻāϰāĻž āĻĄā§āĻāĻž āϝāĻž āĻāĻāύ āϏā§āύā§āĻĄ āĻāϰāĻž āĻšāĻŦā§ āĨ¤
$url = "https://api.bdbulksms.net/api.php";
$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_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);
//Result
echo $smsresult;
//Error Display
echo curl_error($ch);
?>
āĻ
āĻĨāĻŦāĻž āϝāĻĻāĻŋ āĻāĻĒāύāĻŋ JSON data āĻĒā§āϰā§āϰāύ āĻāϰāϤ⧠āύāĻž āĻĒāĻžāϰā§āύ āϤāĻŦā§ āύāĻŋāĻā§āϰ āĻĒāĻĻā§āϧāϤāĻŋāϤā§āĻ Database or any Loop āĻĨā§āĻā§ Many to Many SMS āĻĒā§āϰā§āϰāĻŖ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύāĨ¤
Form-urlencoded Format:
(āĻāĻā§āώā§āϤā§āϰ⧠smsdata āĻāĻŦāĻ token āĻāĻ āĻĻā§āĻāĻāĻŋ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāĻāĻžāϰ āĻĒā§āĻžāϏā§āĻ āĻŽā§āϝāĻžāĻĨā§āĻĄā§ āĻĒāĻžāĻ āĻžāϤ⧠āĻšāĻŦā§, āĻŽā§āϝāĻžāϏā§āĻāĻāĻŋ āĻ
āĻŦāĻļā§āϝāĻ urlencode āĻāϰāϤ⧠āĻšāĻŦā§ āĨ¤
Test : https://reqbin.com/fhtsgkur
Parameters:
token = Generate from above link
smsdata=[{"to":"+8801xxxxxxxxx","message":"firstsmstest"},{"to":"018xxxxxxxxxxx","message":"secondmesssagehere"}]
āĻ
āύā§āĻā§āϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ json output āĻĻā§ā§ āύāĻž, āĻ
āĻĨāĻŦāĻž json āĻāϰ āĻĒāϰāĻŦāϰā§āϤāĻŋ form-urlencoded āĻ āĻĄā§āĻāĻž āϏā§āύā§āĻĄ āĻāϰāϤ⧠āĻāĻžāύ āĻ āĻā§āώā§āϤā§āϰ⧠āĻĢāϰāĻŽā§āϝāĻžāĻ āĻāϰ āĻāĻžāĻāĻāĻž āĻāĻŽāϰāĻž programatically āĻāϰāĻŦā§āĻž āĨ¤ āĻāϰ āĻĢāϞ⧠āĻāĻāĻŋ āĻļā§āϧ⧠āϝ⧠āĻĄā§āĻāĻžāĻŦā§āĻ āĻ āĻāĻžāĻ āĻāϰāĻŦā§ āϤāĻž āύāĻž āϏāĻāϞ āϧāϰāύā§āϰ āϞā§ā§āĻĒā§ āĻāĻžāĻ āĻāϰāĻŦā§ āĨ¤
āĻāĻāĻžāĻŦā§ āĻāĻĒāύāĻŋ āĻā§ā§āĻ āϏā§āĻā§āύā§āĻĄ āĻšāĻžāĻāĻžāϰ āĻšāĻžāĻāĻžāϰ āĻĄāĻžāĻāύāĻžāĻŽāĻŋāĻ SMS āĻāĻāϏāĻžāĻĨā§ āĻĒā§āϰāϏā§āϏ āĻāϰ⧠āĻāĻŽāĻžāĻĻā§āϰ āϏāĻžāϰā§āĻāĻžāϰ⧠āĻĒā§āϰā§āϰāύ āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤ āĻāϤ⧠āĻāĻĒāύāĻžāϰ āĻā§ā§āĻŦ āϏāĻžāϰā§āĻāĻžāϰ⧠āĻāĻŽ āϞā§āĻžāĻĄ āĻĒāϰāĻŦā§ āĨ¤
<?php
$json_smsdata = [];
// āĻĒā§āϰāĻĨāĻŽā§ āĻāĻĒāύāĻžāϰ āϏā§āĻŦāĻŋāϧ⧠āĻŽāϤ āĻāϰ⧠loop āĻ āĻĄā§āĻāĻžāĻŦā§āĻ āĻšāϤ⧠āĻĄā§āĻāĻž āύāĻŋāύ āĻ
āĻĨāĻŦāĻž āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύā§āϰ āĻāύāĻĒā§āĻ āĻĨā§āĻā§ āĻĄā§āĻāĻž āύāĻŋāύ āĨ¤ āĻĄā§āĻāĻžāĻāĻŋ āĻāϰāĻĒāϰ loop āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠āĻĢāϰāĻŽā§āϝāĻžāĻ āĻāϰā§āύ: āĻāĻāĻžāύ⧠while loop āĻĻā§āĻāĻžāύā§āĻž āĻšā§ā§āĻā§ āĻāĻĒāύāĻžāϰāĻž foreach 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();
}
//āĻāĻžāĻāϞ⧠LIMIT āĻĻāĻŋā§ā§ ā§Ģā§Ļā§Ļ SMS āĻāĻāϏāĻžāĻĨā§ āĻĄā§āĻāĻžāĻŦā§āĻ āĻĨā§āĻā§ āϝāĻžāĻŦā§ āĻāĻŽāύ āϞāĻŋāĻŽāĻŋāĻ āĻāϰ⧠āύāĻŋāϤ⧠āĻĒāĻžāϰā§āύ āĨ¤
$sqlquery = "SELECT name,number FROM table_name";
if ($result = mysqli_query($dblink, $sqlquery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$name = $row["name"];
$number = $row["number"];
// āĻāĻŽāϰāĻž āĻāĻĒāϰ⧠loop āĻāϰ⧠āĻĄā§āĻāĻžāĻŦā§āĻ āĻĨā§āĻā§ name āĻāĻŦāĻ number āĻāϞāĻžāĻŽā§āϰ āĻĄā§āĻāĻž āύāĻŋāϞāĻžāĻŽ āĻāĻĒāύāĻŋ āĻĄā§āĻāĻžāĻŦā§āĻ/āϝā§āĻā§āĻžāύā§āĻž āϞā§āϝā§āĻĒ āĻĨā§āĻā§āĻ āĻĄā§āĻāĻž āύāĻŋāϤ⧠āĻĒāĻžāϰā§āύ, āĻāĻāύ dynamic āĻŽā§āϝāĻžāϏā§āĻ āϞāĻŋāĻā§āύ rawurlencode() funtion must use āĻāϰāϤ⧠āĻšāĻŦā§
$message = rawurlencode("Hi $name,
your message
Regards
bdsms.net
");
$json_smsdata[]= ['to'=>$number,'message'=>$message];
}
}
$smsdata = json_encode($json_smsdata);
// $smsdata āĻšāϞā§āĻž āĻāĻŽāĻžāĻĻā§āϰ āĻāĻžāĻāĻāĻŋāϤ format āĻāϰāĻž āĻĄā§āĻāĻž āϝāĻž āĻāĻāύ āϏā§āύā§āĻĄ āĻāϰāĻž āĻšāĻŦā§ āĨ¤
//āĻāĻŦāĻžāϰ SMS āĻĒā§āϰā§āϰāύ āĻāϰā§āύ āύāĻŋāĻā§ āĻļā§āϧ⧠āĻā§āĻžāĻā§āύ āĻŦāĻĻāϞ āĻāϰāĻŦā§āύ
$token = "yourtokenhere_xxxxxxxxxxxxxxxxxxx";
$smsdata = $smsdata;
$url = "https://api.bdbulksms.net/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, $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";
//āĻāĻāĻŋāĻĒāĻŋ āϰāĻŋāĻā§ā§ā§āϏā§āĻ āϞāĻŋāĻŽāĻŋāĻ āϰāĻŋāϏā§āĻ āĻāϰ⧠āĻĻā§āĻā§āĻž āĻšāϞ⧠āĨ¤
$_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'];
}
// āĻĻā§āĻā§āύ āĻāϤāĻŦāĻžāϰ āĻāĻāĻāĻŋ āĻāĻāĻĒāĻŋ āĻĨā§āĻā§ āĻāĻāĻŋāĻĒāĻŋ āϰāĻŋāĻā§ā§ā§āϏā§āĻ āĻāϰāĻž āĻšā§ā§āĻā§ āĻāĻŋāύā§āϤ⧠āĻā§āϰāĻŋāĻĢāĻžāĻ āĻāϰāĻž āĻšā§āύāĻŋ āĨ¤ āĻāĻāĻžāύ⧠āĻĒā§āϰāϤāĻŋ session āĻ 5 āĻŦāĻžāϰ maximum āĻāĻāĻŋāĻĒāĻŋ āϰāĻŋāĻā§ā§ā§āϏā§āĻ āĻāϰāĻž āϝāĻžāĻŦā§ āĨ¤ 5 āĻŦāĻžāϰ āĻāĻāĻŋāĻĒāĻŋ āĻĒā§āϰā§āϰāύ āĻāϰ⧠āĻāĻāĻŦāĻžāϰāĻ āϝāĻĻāĻŋ āĻā§āϰāĻŋāĻĢāĻžāĻ āύāĻž āĻāϰ⧠āϤāĻŦā§ āĻĒā§āύāϰāĻžā§ āĻāĻāĻŋāĻĒāĻŋ āϰāĻŋāĻā§ā§ā§āϏā§āĻ āĻāϰāĻž āϝāĻžāĻŦā§ āύāĻž āĨ¤ āĻ
āύā§āĻā§ āĻŦāĻžāϰ āĻŦāĻžāϰ unknown āύāĻžāĻŽā§āĻŦāĻžāϰ⧠āĻāĻāĻŋāĻĒāĻŋ āϰāĻŋāĻā§āĻžā§ā§āϏā§āĻā§ āĻĻāĻŋā§ā§ āĻŽāĻžāύā§āώāĻā§ āĻŦāĻŋāϰāĻā§āϤ āĻāϰāϤ⧠āĻĒāĻžāϰ⧠/āĻāĻĒāύāĻžāϰ SMS āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻļā§āώ āĻāϰāϤ⧠āĻĒāĻžāϰā§, āĻāĻāĻŋ āϤāĻž prevent āĻāϰāĻŦā§ āĨ¤ āĻāĻžāĻāϞ⧠āϞāĻŋāĻŽāĻŋāĻ āĻŦāĻžā§āĻžāϤ⧠āĻāĻŋāĻāĻŦāĻž āĻāĻŽāĻžāϤ⧠āĻāĻŋāĻāĻŦāĻž āĻāĻāĻŋ āĻŦāĻžāĻĻ āĻĻāĻŋāϤ⧠āĻĒāĻžāϰā§āύ āĨ¤ āϤāĻŦā§ āύāĻŋāϰāĻžāĻĒāϤā§āϤā§āĻŦāĻžāϰ āĻāύā§āϝ āϞāĻŋāĻŽāĻŋāĻ āϰāĻžāĻāĻž āĻāĻžāϞ⧠āĨ¤ āĻāĻžāĻāϞ⧠āĻĄā§āĻāĻžāĻŦā§āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠āϞāĻŋāĻŽāĻŋāĻ āĻāϰāϤ⧠āĻĒāĻžāϰā§āύ, āĻāĻžāĻāĻŽ āĻĻāĻŋā§ā§ āϞāĻŋāĻŽāĻŋāĻ āĻāϰāϤ⧠āĻĒāĻžāϰā§āύ āĨ¤
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 = "āĻāĻĒāύāĻžāϰ āĻāĻāĻŋāĻĒāĻŋ āĻā§āĻĄ: $code
XYZ āĻā§āĻŽā§āĻĒāĻžāύā§";
$url = "https://api.bdbulksms.net/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 āϞāĻŋāĻŽāĻŋāĻ āϏā§āĻ āĻāϰāĻž āĻšāϞā§
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();
}
?>
āĻāĻĒāϰ⧠āĻĒā§āϰāĻĻāϤā§āϤ āĻā§āĻžāĻĄāĻāĻŋ āϝ⧠āĻĒā§āĻāĻā§ āϏāĻŋāĻāĻŋāĻāϰ āĻāϰāϤ⧠āĻāĻžāύ āĻ
āϰā§āĻĨāĻžā§ āϝ⧠āĻĒā§āĻā§āϰ āĻāύāĻā§āύā§āĻ āĻĻā§āĻāĻžāϰ āĻāύā§āϝ āĻāĻāĻāĻžāϰāĻā§ āĻĒā§āϰāĻĨāĻŽā§ āĻŽā§āĻžāĻŦāĻžāĻāϞ āύāĻžāĻŽā§āĻŦāĻžāϰ āĻĻāĻŋāϤ⧠āĻšāĻŦā§, āĻāϰāĻĒāϰ āĻā§āĻžāĻĄ āĻĻāĻŋā§ā§ āĻā§āϰāĻŋāĻĢāĻŋāĻā§āĻļāύ āĻāϰāϤ⧠āĻšāĻŦā§ āϏā§āĻ āĻĒā§āĻ āĻāĻĄāĻŋāĻ āĻāϰ⧠āĻāĻāĻĻāĻŽ āĻāĻĒāϰ⧠āĻĒā§āϏā§āĻ āĻāϰ⧠āĻĻāĻŋāύ āĨ¤
āĻāĻĒāύāĻžāϰ āĻāĻāĻāĻžāϰ āĻāĻāĻŋāĻĒāĻŋ āĻĻāĻŋā§ā§ āĻā§āϰāĻŋāĻĢāĻŋāĻā§āĻļāύ āĻāĻŽāĻĒā§āϞāĻŋāĻ āĻāϰāĻžāϰ āĻĒāϰāĻ āĻļā§āϧā§āĻŽāĻžāϤā§āϰ āϏāĻŋāĻāĻŋāĻāϰ āĻāύāĻā§āύā§āĻ āĻĻā§āĻāϤ⧠āĻĒāĻžāϰāĻŦā§ āĨ¤ āĻāĻāĻŋ āĻŽāĻĄāĻŋāĻĢāĻžāĻ āĻāϰ⧠āύāĻŋāĻā§āϰ āĻĒā§āϰā§ā§āĻāύ āĻ
āύā§āϝāĻžā§ā§ āϝā§āĻā§āύ⧠PHP āĻĒā§āĻā§ āĻŦāϏāĻžāϤ⧠āĻĒāĻžāϰāĻŦā§āύ āĨ¤ āĻ
āĻŦāĻļā§āϝāĻ āĻā§āĻāϞ āϰāĻŋāĻā§āϝāĻžāĻĒāĻāĻž āϏāĻŋāĻāĻŋāĻāϰāĻŋāĻāĻŋāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ āĨ¤
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 smsData = {
'token': '1234567890123456789',
'to': mobile,
'message': 'Hello this is a test sms. cell data:'+gwcelldata
};
var options = {
'method' : 'post',
'payload' : smsData
};
var response = UrlFetchApp.fetch('https://api.bdbulksms.net/api.php?json', options);
Logger.log(response);
}
āĻā§āĻāϞāĻļā§āĻā§āϰ āϝā§āĻā§āĻžāύā§āĻž āĻāϞāĻžāĻŽ āĻāĻĄāĻŋāĻ āĻāϰāϞ⧠āĻ
āĻĨāĻŦāĻž āύāϤā§āύ āĻāϞāĻžāĻŽ āĻ
ā§āϝāĻžāĻĄ āĻāϰāϞ⧠āϏā§āĻŦā§āĻāĻā§āϰāĻŋā§āĻāĻžāĻŦā§ āĻāϏāĻāĻŽāĻāϏ āĻĒā§āϰā§āϰāĻŖ āĻāϰāĻžāϰ āĻĒāĻĻā§āϧāϤāĻŋ:
Instruction: āύāϤā§āύ "OnEdit" trigger āϤā§āϰāĻŋ āĻāϰā§āύ āĻāĻŦāĻ āύāĻŋāĻā§āϰ āĻ
ā§āϝāĻžāĻĒāϏā§āĻā§āϰāĻŋāĻĒā§āĻ āĻā§āĻžāĻĄ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύāĨ¤
function GreenwebOnChange(e){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var respSheet = ss.getSheetByName('Sheet1');
var rowIndx = e.range.getRow();
var allcolumns = respSheet.getDataRange().getValues();
var sheetData = respSheet.getRange(rowIndx, 1, 1, respSheet.getLastColumn()).getValues();
function gweb(number) {
const [integer, decimals] = number.toString().split(".");
if (decimals) {
return BigInt(integer).toString() + "." + BigInt(decimals).toString();
}
return BigInt(integer).toString();
}
var name = sheetData.at(0)[1];
var mobile = gweb(sheetData.at(0)[2]);
var anything = sheetData.at(0)[4];
var smsstatus = sheetData.at(0)[4];
//Logger.log(mobile);
//smsstatus empty so send sms
if (smsstatus=='') {
//check data inserted or not
if ((name !='') && (mobile !='')) {
var formData = {
'token': '1234567890123456789',
'to': mobile,
'message': 'Hello '+name+' this is a test sms. anything:'+anything
};
var options = {
'method' : 'post',
'payload' : formData
};
var smsresponses = UrlFetchApp.fetch('https://api.bdbulksms.net/api.php?json', options);
var smsresponse = JSON.parse(smsresponses);
var smsstatus = smsresponse[0].status;
var smsstatusmsg = smsresponse[0].statusmsg;
//Logger.log(smsresponse[0].status);
var smsstatuscol = allcolumns[0].indexOf('smsstatus');
var smsdetailscol = allcolumns[0].indexOf('smsdetails');
respSheet.getRange(rowIndx, ((smsstatuscol) + 1)).setValue(smsstatus);
respSheet.getRange(rowIndx, ((smsdetailscol) + 1)).setValue(smsstatusmsg);
}
}
}
āĻā§āĻāϞāĻĢāϰā§āĻŽ āϏāĻžāĻŦāĻŽāĻŋāĻ āĻāϰāϞ⧠āϰāĻŋāϏāĻĒāύā§āϏ āĻĒā§āϰāĻĻāĻžāύāĻāĻžāϰā§āĻā§/āĻāĻĄāĻŽāĻŋāύ/āϝ⧠āĻāĻžāĻāĻā§ āύāϤā§āύ āϰāĻŋāϏāĻĒāύā§āϏ āϏā§āĻŦā§āĻāĻā§āϰāĻŋā§āĻāĻžāĻŦā§ āĻāϏāĻāĻŽāĻāϏ āĻāϰ āĻŽāĻžāϧā§āϝāĻŽā§ āĻĒā§āϰā§āϰāĻŖ āĻāϰāĻžāϰ āĻĒāĻĻā§āϧāϤāĻŋ:
āĻā§āĻāϞ APP Script āĻ āύāĻŋāĻā§āϰ āĻā§āĻžāĻĄāĻāĻŋ āϞāĻŋāĻā§āύ āĻāϰāĻĒāϰ āĻāĻāĻāĻŋ on form submit āĻā§āϰāĻŋāĻāĻžāϰ āϤā§āϰāĻŋ āĻāϰā§āύāĨ¤
function GreenwebSubmitForm(e){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var respSheet = ss.getSheetByName('Form responses 1');
var rowIndx = e.range.getRow();
var formData = respSheet.getRange(rowIndx, 1, 1, respSheet.getLastColumn()).getValues();
function gweb(number) {
const [integer, decimals] = number.toString().split(".");
if (decimals) {
return BigInt(integer).toString() + "." + BigInt(decimals).toString();
}
return BigInt(integer).toString();
}
var name = formData.at(0)[1];
var mobile = gweb(formData.at(0)[2]);
var anything = formData.at(0)[3];
var smsData = {
'token': '1234567890123456789',
'to': mobile,
'message': 'Hello '+name+' this is a test sms. anything:'+anything
};
var options = {
'method' : 'post',
'payload' : smsData
};
var smsresponses = UrlFetchApp.fetch('https://api.bdbulksms.net/api.php?json', options);
var smsresponse = JSON.parse(smsresponses);
var smsstatus = smsresponse[0].status;
var smsstatusmsg = smsresponse[0].statusmsg;
Logger.log(smsstatusmsg);
}
For more information check: https://developers.google.com/apps-script/reference/spreadsheet/sheet
<%
apiurl = "https://api.bdbulksms.net/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 = "https://api.bdbulksms.net/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("https://api.bdbulksms.net/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 "https://api.bdbulksms.net/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="https://api.bdbulksms.net/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 = "https://api.bdbulksms.net/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 = "https://api.bdbulksms.net/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) := 'https://api.bdbulksms.net/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('https://api.bdbulksms.net/api.php', greenwebsms).then(response => {
console.log(response.data);
});
āĻĒāĻĻā§āϧāϤāĻŋ ⧍:
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.bdbulksms.net',
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();
var url = "https://api.bdbulksms.net/api.php?json";
data = new FormData()
data.set('token', '1234567890123456789')
data.set('message','test sms')
data.set('to','017xxxxxxxx')
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.send(data);
xhr.onload = function() {
var response = JSON.parse(this.responseText);
console.log(response);
};
āĻĒāĻĻā§āϧāϤāĻŋ ⧍: āĻĄā§āĻŽā§āĻž: https://jsfiddle.net/greenwebbd/g2bf9awk/
var url = "https://api.bdbulksms.net/api.php?json";
data = new FormData()
data.set('token', '1234567890123456789')
data.set('message','test sms')
data.set('to','017xxxxxxxx')
fetch(url, {
method:"POST",
body: data
}).then(response => response.json())
.then(result => {
console.log('Success:', result);
})
.catch((error) => {
console.error('Error:', error);
});
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("https://api.bdbulksms.net/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 = "https://api.bdbulksms.net/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)
SMS Gateway URL: https://api.bdbulksms.net/api.php
HTTP Header: āĻĢāĻžāĻāĻāĻž āϰāĻžāĻā§āύ
HTTP Method: POST
Gateway Parameters: token:1234567890123456789,to:{to},message:{message}
Send as Body Data: No
Encode Message: No
Phone Number: āϝā§āĻā§āĻžāύā§āĻž āĻāĻāĻāĻž āϏā§āĻ āĻāϰā§āύ
Sender ID: āĻāĻŋāĻā§ āϏā§āĻ āĻāϰāĻžāϰ āĻĒā§āϰā§ā§āĻžāĻāύ āύā§āĻ
Message Template: (YourCompanyName) Your OTP is {OTP}
@{DOMAIN}, #{OTP}
Note: 1234567890123456789 āĻā§āĻžāĻā§āύā§āϰ āĻāĻžā§āĻāĻžā§ āĻāĻĒāύāĻžāϰ āĻā§āĻžāĻā§āύ āĻā§āύāĻžāϰā§āĻ āĻāϰ⧠āĻĻāĻŋāύ Message āĻ YourCompanyName āĻāϰ āĻāĻžā§āĻāĻžā§ āĻŦā§āϰāĻžāĻā§āĻā§ āĻā§āĻžāĻŽā§āĻĒāĻžāύā§āϰ āύāĻžāĻŽ āĻĻāĻŋāύāĨ¤ āĻā§āĻžāĻā§āύ āĻā§āύāĻžāϰā§āĻ āĻāϰāϤ⧠āĻāĻŋāĻāĻŋāĻ āĻāϰā§āύ: https://gwb.li/token
āĻāĻŋāĻāĻšāĻžāĻŦ āĻĒā§āϰā§āĻžāĻā§āĻā§āĻ āϞāĻŋāĻāĻ ā§§ (āĻ
āĻĢāĻŋāĻļāĻŋā§āĻžāϞ): https://github.com/bdgreenweb/Laravel-sms-package-for-bdbulksms.net-SMS-API/
āĻāĻŋāĻāĻšāĻžāĻŦ āĻĒā§āϰā§āĻžāĻā§āĻā§āĻ āϞāĻŋāĻāĻ ā§¨ (āĻāύāĻ
āĻĢāĻŋāĻļāĻŋā§āĻžāϞ): https://github.com/bdgreenweb/laravel-greenweb-sms

Bangla Manual
English Manual