loder

API Document

image
image
Note:- We Have Listed Commonly Used API's Here. For Other API's Please Contact Us.

API Authentication Key
For API Authkey Kindly Login To Your Sms Account
Kindly Note:-

--> Please Add Your DLT Approved Entity , Header and Templates Details in DLT Database.

--> Our System will auto capture DLT Details From Database.

--> Below APIs Will Work With All Programming Languages.

--> For any Kind Of Support Please Contact Our Support Team.

Normal Api
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990&message=test message&sender=senderid&route=4
Send Multiple Numbers
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990,919999999999,919999999909&message=test message&sender=senderid&route=4
Send unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey& mobiles=9999999999,919999999999&message=test message&sender=senderid&unicode=y&route=4
Send schedule message
GET / POSThttps://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&message=test message&sender=senderid&schedule=2016/08/25 18:30&route=4
Schedule unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&message=test message&sender=senderid&schedule=2016/08/25 18:30&unicode=y&route=4
OTP Gateway
GET / POST https://www.tripadasmsbox.com/api/otp_api.php?auth_key=YourAuthKey&mobiles=919999999990&message=test message&sender=senderid
Kindly Note:-

--> Please Add Your DLT Approved Entity and Header Details in DLT Database.

--> Below APIs Will Work With All Programming Languages.

--> For any Kind Of Support Please Contact Our Support Team.

Normal Api
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990&templateid=yourtemplateid&message=test message&sender=senderid&route=4
Send Multiple Numbers
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990,919999999999&templateid=yourtemplateid&message=test message&sender=senderid&route=4
Send unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&templateid=yourtemplateid&message=test message&sender=senderid&unicode=y&route=4
Send schedule message
GET / POSThttps://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&templateid=yourtemplateid&message=test message&sender=senderid&schedule=2016/08/25 18:30&route=4
Schedule unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&templateid=yourtemplateid&message=test message&sender=senderid&schedule=2016/08/25 18:30&unicode=y&route=4
OTP Gateway
GET / POST https://www.tripadasmsbox.com/api/otp_api.php?auth_key=YourAuthKey&mobiles=919999999990&templateid=yourtemplateid&message=test message&sender=senderid
Kindly Note:-

--> Please Add Your DLT Approved Header Details in DLT Database.

--> Below APIs Will Work With All Programming Languages.

--> For any Kind Of Support Please Contact Our Support Team.

Normal Api
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid&route=4
Send Multiple Numbers
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=919999999990,919999999999&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid&route=4
Send unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey& mobiles=9999999999,919999999999&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid&unicode=y&route=4
Send schedule message
GET / POSThttps://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid&schedule=2016/08/25 18:30&route=4
Schedule unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapi.php?auth_key=YourAuthKey&mobiles=9999999999,919999999999&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid&schedule=2016/08/25 18:30&unicode=y&route=4
OTP Gateway
GET / POST https://www.tripadasmsbox.com/api/otp_api.php?auth_key=YourAuthKey&mobiles=919999999990&templateid=yourtemplateid&peid=yourpeid&message=test message&sender=senderid
Kindly Note:-

--> Please Add Your DLT Approved Entity , Header and Templates Details in DLT Database.

--> Our System will auto capture DLT Details From Database.

--> Below APIs Will Work With All Programming Languages.

--> For any Kind Of Support Please Contact Our Support Team.

Normal Api
GET / POST https://www.tripadasmsbox.com/api/sendapiup.php?username=username&password=password&mobiles=919999999990&message=test message&sender=senderid&route=4
Send Multiple Numbers
GET / POST https://www.tripadasmsbox.com/api/sendapiup.php?username=username&password=password&mobiles=919999999990,919999999999&message=test message&sender=senderid&route=4
Send unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapiup.php?username=username&password=password&mobiles=9999999999,919999999999&message=test message&sender=senderid&unicode=y&route=4
Send schedule message
GET / POSThttps://www.tripadasmsbox.com/api/sendapiup.php?username=username&password=password&mobiles=9999999999,919999999999&message=test message&sender=senderid&schedule=2016/08/25 18:30&route=4
Schedule unicode message
GET / POST https://www.tripadasmsbox.com/api/sendapiup.php?username=username&password=password&mobiles=9999999999,919999999999&message=test message&sender=senderid&schedule=2016/08/25 18:30&unicode=y&route=4
OTP Gateway
GET / POST https://www.tripadasmsbox.com/api/otp_apiup.php?username=username&password=password&mobiles=919999999990&message=test message&sender=senderid
You Can also Pass Additional Parameter DLT Entity ID as : PEID=xxxx ( Not Mandatory )
Normal XML Format
POST https://www.tripadasmsbox.com/api/xml_send_sms.php
 <MESSAGE>
<AUTHKEY>Authentication key</AUTHKEY>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID>
<SENDER>SenderID</SENDER>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
</SMS>
</MESSAGE>
Send XML On Multiple Numbers
 <MESSAGE>
<AUTHKEY>Authentication key</AUTHKEY>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Schedule Message
 <MESSAGE>
<AUTHKEY>Authentication key</AUTHKEY>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SCHEDULE>YYYY/MM/DD HH:MM</SCHEDULE>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Sending Customize Message
 <MESSAGE>
<AUTHKEY>Authentication key</AUTHKEY>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SMS TEXT="message1">
<ADDRESS>number1</ADDRESS>
</SMS>
<SMS TEXT="message2">
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Unicode Message Send
 <MESSAGE>
<AUTHKEY>Authentication key</AUTHKEY>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<UNICODE>y</UNICODE>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
</SMS>
</MESSAGE>
You Can also Pass Additional Parameter DLT Entity ID as : PEID=xxxx ( Not Mandatory )
Normal XML Format
POST https://www.tripadasmsbox.com/api/xml_send_sms.php
 <MESSAGE>
<USERNAME>Username</USERNAME>
<PASSWORD>Password</PASSWORD>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID>
<SENDER>SenderID</SENDER>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
</SMS>
</MESSAGE>
Send XML On Multiple Numbers
 <MESSAGE>
<USERNAME>Username</USERNAME>
<PASSWORD>Password</PASSWORD>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Schedule Message
 <MESSAGE>
<USERNAME>Username</USERNAME>
<PASSWORD>Password</PASSWORD>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SCHEDULE>YYYY/MM/DD HH:MM</SCHEDULE>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Sending Customize Message
 <MESSAGE>
<USERNAME>Username</USERNAME>
<PASSWORD>Password</PASSWORD>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<SMS TEXT="message1">
<ADDRESS>number1</ADDRESS>
</SMS>
<SMS TEXT="message2">
<ADDRESS>number2</ADDRESS>
</SMS>
</MESSAGE>
Unicode Message Send
 <MESSAGE>
<USERNAME>Username</USERNAME>
<PASSWORD>Password</PASSWORD>
<ROUTE>1</ROUTE >
<TEMPLATEID>Template Id</TEMPLATEID >
<SENDER>SenderID</SENDER>
<UNICODE>y</UNICODE>
<SMS TEXT="hii this is test message">
<ADDRESS>number1</ADDRESS>
</SMS>
</MESSAGE>
Check Balance
GET https://www.tripadasmsbox.com/api/balance.php?auth_key=YourAuthKey&type=1
Change Password
GET https://www.tripadasmsbox.com/api/change_password.php?auth_key=YourAuthKey&password=password&newpass=newpassword&confirmpass=confirmpass
Check Username and Password
GET https://www.tripadasmsbox.com/api/check_user.php?username=username&password=password
Check Authkey
GET https://www.tripadasmsbox.com/api/valid_auth.php?auth_key=YourAuthKey
Report Api
GET https://www.tripadasmsbox.com/api/dlrreport.php?auth_key=YourAuthKey&req_id=RequestID
Push DLR
For This API Kindly Login To Your Sms Account
Parameter Name Description
auth_key * Login authentication key
templateid Your DLT Template Id
peid Your DLT PE Id
mobiles * Your Mobile number
message * Your Message
sender * Your sender ID
route * Your Route, Use route=1 for promotional or route=4 for transactional
unicode If SMS is Unicode Use unicode=y
schedule For schedule SMS Use Time Format YYYY/MM/DD HH:MM Eg: schedule=2016/08/25 18:30 Use 24 Hour Formate
campaign Campaign Name
* => Required Parameter

Missing parameters
Error code Description
201 Missing mobile no
202 Missing message
203 Missing sender ID
204 Missing password
205 Missing Authentication Key
206 Missing Route
207 Missing username
208 Missing Unicodes
209 Missing Schedule
210 Missing Campaign
211 Missing Template Id
Invalid Parameters
Error code Description
401 You must have to entered valid mobile number
402 Invalid sender ID. Your sender ID must be 6 characters, alphabetic.
403 Invalid authentication key. Crosscheck your authentication key from your account’s API section.
404 Invalid Route.
405 Block Text.
406 Parameter's value are empty : message.
407 Campaign name cannot be greater than 32 characters.
408 Same Request cannot send in 20 second
409 Sender Id Not Approved
410 Template Id Should Be Numeric Only
Error Codes
Error code Description
601 Insufficient balance to send SMS.
602 Expired user account. You need to contact your account manager.
603 Banned user account. You need to contact your account manager.
604 This route is currently unavailable. You can send SMS from this route only between 9 AM - 9 PM.
605 Incorrect scheduled time. required format YYYY/MM/DD HH:MM
606 SMS is too long. message length must be '2907' characters
607 For API : Maximum 10000 Number In One Request
608 Maximum 20 Request
609 For XML : Maximum 50000 Number In One Request
610 Maximum Length For Template Id Is 25 Characters.

Note:- Below Given Sample Codes Are For Referance Purpose Only. You Need To Change As Per Your System And Requirements.

ASP
POST/GET
<% auth_key = "YourAuthKey"
address = "https://www.tripadasmsbox.com/api/sendapi.php?"
message = "test message"
message = Server.urlencode(message)
mobiles = "919999999990"
sender = "senderid"
url = address & "auth_key=" & auth_key & "&mobiles=" & mobiles & "&message=" & message & "&sender=" & sender
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.send ""
msg = xmlhttp.responseText
response.write(msg)
set xmlhttp = nothing
%>
ASP.NET
POST/GET
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
Sub Page_Load(sender As Object, e As EventArgs)
Dim auth_key As String = "YourAuthKey"
Dim SenderName As String = "MyName"
Dim mobiles As String = "919999999990"
Dim message As String = "test message"
Dim address As String = "https://www.tripadasmsbox.com/api/sendapi.php?"
Dim PostData As String = "auth_key=" & auth_key & "&sender=" & SenderName & "&mobiles=" & mobiles & "&message=" & message
Dim req As HttpWebRequest = WebRequest.Create(URL)
req.Method = "POST"
Dim encoding As New ASCIIEncoding()
Dim byte1 As Byte() = encoding.GetBytes(PostData)
req.ContentType = "application/x-www-form-urlencoded"
req.ContentLength = byte1.Length
Dim newStream As Stream = req.GetRequestStream()
newStream.Write(byte1, 0, byte1.Length)
Try
Dim resp As HttpWebResponse = req.GetResponse()
Dim sr As New StreamReader(resp.GetResponseStream())
Dim results As String = sr.ReadToEnd()
sr.Close()
html.Text = results
Catch wex As WebException
Response.Write("SOMETHING WENT AWRY!
Status: " & wex.Status & "message: " & wex.Message & "")
End Try
End Sub
C#
POST/GET
using System;
using System.Collections.Generic;
using System.Net;
using System.Collections.Specialized;
namespace sendSMS
{
class sendSMS
{
public string sendSMS()
{
String message = HttpUtility.UrlEncode("test message");
using (var wb = new WebClient())
{
byte[] response = wb.UploadValues("https://www.tripadasmsbox.com/api/sendapi.php/", new NameValueCollection()
{
{"auth_key" , "YourAuthKey"},
{"mobiles" , "919999999990"},
{"message" , message},
{"sender" , "senderid"}
});
string result = System.Text.Encoding.UTF8.GetString(response);
return result;
}
}
}
}
Delphi
POST/GET
function SendSMS(auth_key, sender, mobiles, message: String):string;
const
URL = 'https://www.tripadasmsbox.com/api/sendapi.php?auth_key=%s&sender=%s&mobiles=%s&message=%s';
ResponseSize = 1024;
var
hSession, hURL: HInternet;
Request: String;
ResponseLength: Cardinal;
begin
hSession := InternetOpen('DrBob42', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
Request := Format(URL,[auth_key,sender,mobiles,HttpEncode(message)]);
hURL := InternetOpenURL(hSession, PChar(Request), nil, 0,0,0);
try
SetLength(Result, ResponseSize);
InternetReadFile(hURL, PChar(Result), ResponseSize, ResponseLength);
SetLength(Result, ResponseLength)
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end
end;
Java
POST/GET
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class sendSMS {
public String sendSms() {
try {
// Construct data
String auth_key = "auth_key=" + "YourAuthKey";
String message = "&message=" + "test message";
String sender = "&sender=" + "senderid";
String mobiles = "&mobiles=" + "919999999990";
// Send data
HttpURLConnection conn = (HttpURLConnection) new URL("https://www.tripadasmsbox.com/api/sendapi.php?").openConnection();
String data = auth_key + mobiles + message + sender;
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
conn.getOutputStream().write(data.getBytes("UTF-8"));
final BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
final StringBuffer stringBuffer = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
stringBuffer.append(line);
}
rd.close();
return stringBuffer.toString();
} catch (Exception e) {
System.out.println("Error SMS "+e);
return "Error "+e;
}
}
}
Perl
POST/GET
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
my $auth_key = 'YourAuthKey';
my $sender = "senderid";
my $mobiles = "919999999990";
my $message = "test message";
my $ua = LWP::UserAgent->new();
my $res = $ua->request
(
POST 'https://www.tripadasmsbox.com/api/sendapi.php?',
Content_Type => 'application/x-www-form-urlencoded',
content => [
'auth_key' => $auth_key,
'mobiles' => $mobiles,
'message' => $message,
'sender' => $sender
]
);
if ($res->is_error) { die "HTTP Error\n"; }
print "Response:\n\n" . $res->content . "\n\n";
PHP
POST/GET
// Account details
$auth_key = urlencode(‘YourAuthKey’);
// Message details
$mobiles = array(919999999990, 919999999999);
$sender = urlencode(‘senderid’);
$message = rawurlencode(‘test message’);
$mobiles = implode(‘,’, $mobiles);
// Prepare data for POST request
$data = array(‘auth_key’ => $auth_key, ‘mobiles’ => $mobiles, “sender” => $sender, “message” => $message);
// Send the POST request with cURL
$ch = curl_init(‘https://www.tripadasmsbox.com/api/sendapi.php/’);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// Process your response here
echo $response;
Android
POST/GET
//Your authentication key
String auth_key = "YourAuthKey";
//Multiple mobiles numbers separated by comma
String mobiles = "919999999990";
//Sender ID,While using route4 sender id should be 6 characters long.
String senderId = "257865";
//Your message to send, Add URL encoding here.
String message = "test message";
//define route
String route="default";
URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;
//encoding message
String encoded_message=URLEncoder.encode(message);
//Send SMS API
String mainUrl="https://www.tripadasmsbox.com/api/sendapi.php?";
//Prepare parameter string
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("auth_key="+auth_key);
sbPostData.append("&mobiles="+mobiles);
sbPostData.append("&message="+encoded_message);
sbPostData.append("&route="+route);
sbPostData.append("&sender="+senderid);
//final string
mainUrl = sbPostData.toString();
try
{
//prepare connection
myURL = new URL(mainUrl);
myURLConnection = myURL.openConnection();
myURLConnection.connect();
reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
//reading response
String response;
while ((response = reader.readLine()) != null)
//print response
Log.d("RESPONSE", ""+response);
//finally close connection
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
Python
POST/GET
#!/usr/bin/env python
import urllib.request
import urllib.parse
def sendSMS(auth_key, mobiles, sender, message):
data = urllib.parse.urlencode({'auth_key': auth_key, 'mobiles': mobiles, 'message' : message, 'sender': sender})
data = data.encode('utf-8')
request = urllib.request.Request("https://www.tripadasmsbox.com/api/sendapi.php?")
f = urllib.request.urlopen(request, data)
fr = f.read()
return(fr)
resp = sendSMS('YourAuthKey', '919999999990',
'senderid', 'test message')
print (resp)
Ruby
POST/GET
require "rubygems"
require "net/https"
require "uri"
require "json"
requested_url = 'https://www.tripadasmsbox.com/api/sendapi.php?'
uri = URI.parse(requested_url)
http = Net::HTTP.start(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = Net::HTTP.post_form(uri, 'auth_key' => 'YourAuthKey', 'message' => 'test message', 'sender' => 'senderid', 'mobiles' => '919999999990')
response = JSON.parse(res.body)
puts (response)
VBA
POST/GET
Public Sub Send()
Dim username As String
Dim password As String
Dim result As String
Dim myURL As String
Dim Sender As String
Dim numbers As String
Dim Message As String
Dim postData As String
Dim winHttpReq As Object
auth_key = "YourAuthKey"
Sender = "senderid"
mobiles = "919999999990"
message = "test message"
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "https://www.tripadasmsbox.com/api/sendapi.php?"
postData = "auth_key=" + auth_key + "&message=" + message + "&mobiles=" + mobiles + "&Sender=" + Sender
winHttpReq.Open "POST", myURL, False
winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
winHttpReq.Send (postData)
SendSMS = winHttpReq.responseText
End Sub
VBA.NET
POST/GET
Imports System.Web
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Resources
Public Class sendSMS
Public Function sendSMS()
Dim auth_key = "YourAuthKey"
Dim message = "test message"
Dim mobiles = "919999999990"
Dim strPost As String
Dim sender = "senderid"
Dim url As String = "https://www.tripadasmsbox.com/api/sendapi.php?"
Dim strPost As String
strPost = url + "auth_key=" + auth_key _
+ "&mobiles=" + mobiles _
+ "&message=" + WebUtility.UrlEncode(message) _
+ "&sender=" + sender
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
iOS
POST/GET
//Create Objects
NSMutableData * responseData;
NSURLConnection * connection;
// In your viewDidLoad method add this lines
-(void)viewDidLoad
{
[super viewDidLoad];
//Your authentication key
NSString * auth_key = @"YourAuthKey";
//Multiple mobiles numbers separated by comma
NSString * mobiles = @"919999999990";
//Sender ID,While using route4 sender id should be 6 characters long.
NSString *senderid = @"TRIPAD";
//Your message to send, Add URL encoding here.
NSString * message = @"Test message";
//define route
NSString * route = @"default";
// Prepare your url to send sms with this parameters.
NSString * url = [[NSString stringWithFormat:@"https://www.tripadasmsbox.com/api/sendapi.php?auth_key=%@&mobiles=%@&message=%@&sender=%@&route=%@", auth_key, mobiles, message, senderid, route] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
} // implement URLConnection Delegate Methods as follow
-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
//Get response data
responseData = [NSMutableData data];
}
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[responseData appendData:data];
}
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedDescription delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
}
-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
// Get response data in NSString.
NSString * responceStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
}
Oracle
POST/GET
set define off;
CREATE OR REPLACE PACKAGE sms_api IS
FUNCTION send_sms(mobiles IN VARCHAR2,
message IN VARCHAR2,
sender IN VARCHAR2,
route IN PLS_INTEGER,
country IN PLS_INTEGER,
flash IN PLS_INTEGER,
unicode IN PLS_INTEGER,
schtime IN VARCHAR2,
campaign IN VARCHAR2,
response IN VARCHAR2 DEFAULT 'text',
auth_key IN VARCHAR2 DEFAULT 'YourAuthKey')
RETURN VARCHAR2;
END sms_api;
/
CREATE OR REPLACE PACKAGE BODY sms_api IS
FUNCTION get_clobFromUrl(p_url VARCHAR2) RETURN CLOB IS
req utl_http.req;
resp utl_http.resp;
val VARCHAR2(32767);
l_result CLOB;
BEGIN
req := utl_http.begin_request(p_url);
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, val, TRUE);
l_result := l_result || val;
END LOOP;
utl_http.end_response(resp);
RETURN l_result;
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
RETURN l_result;
WHEN OTHERS THEN
utl_http.end_response(resp);
RAISE;
END;
FUNCTION send_sms(mobiles IN VARCHAR2,
message IN VARCHAR2,
sender IN VARCHAR2,
route IN PLS_INTEGER,
country IN PLS_INTEGER,
flash IN PLS_INTEGER,
unicode IN PLS_INTEGER,
schtime IN VARCHAR2,
campaign IN VARCHAR2,
response IN VARCHAR2 DEFAULT 'text',
auth_key IN VARCHAR2 DEFAULT 'YourAuthKey')
RETURN VARCHAR2 IS
l_url VARCHAR2(32000) := 'https://www.tripadasmsbox.com/api/sendapi.php?';
l_result VARCHAR2(32000);
BEGIN
l_url := l_url || '?auth_key=' || auth_key;
l_url := l_url || '&mobiles=' || mobiles;
l_url := l_url || '&message=' || message;
l_url := l_url || '&sender=' || sender;
l_url := l_url || '&route=' || route;
l_url := l_url || '&country=' || country;
l_url := l_url || '&flash=' || flash;
l_url := l_url || '&unicode=' || unicode;
IF schtime IS NOT NULL THEN
l_url := l_url || '&schtime=' || schtime;
END IF;
l_url := l_url || '&response=' || response;
l_url := l_url || '&campaign=' || campaign;
l_url := utl_url.escape(l_url);
l_result := get_clobFromUrl(l_url);
RETURN l_result;
END;
END sms_api;
/
C++
POST/GET
#include
#include
#include
int main(void) {
CURL *curl;
CURLcode res;
using namespace std;
curl = curl_easy_init();
if(curl) {
//prepare URL with parameters
string path = "https://www.tripadasmsbox.com/api/sendapi.php? auth_key=xxxxx";
char *receipent = curl_easy_escape(curl, "+9999999999", 0);
char *message = curl_easy_escape(curl, "my message", 0);
string url;
url += path;
url += "&to=";
url += receipent;
url += "&message=";
url += message;
char * urlchar = new char[url.size() + 1];
std::copy(url.begin(), url.end(), urlchar);
urlchar[url.size()] = '\0';
curl_easy_setopt(curl, CURLOPT_URL, urlchar);
//send HTTP GET request
res = curl_easy_perform(curl);
//check for errors
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
return 0;
}
Node Js
POST/GET
var qs = require("querystring");
var http = require("https");
var options = {
"method": "POST",
"hostname": "www.tripadasmsbox.com",
"port": null,
"address": "https://www.tripadasmsbox.com/api/sendapi.php",
"headers": {
"content-type": "application/x-www-form-urlencoded",
"cache-control": "no-cache"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(qs.stringify({ username: 'username',
password: 'password',
sender: 'senderid',
sendMethod: 'simpleMsg',
message: 'test message',
mobiles: '919999999990, 919999999999',
message: 'This is my test message with tripadasmsbox.com',
duplicateCheck: 'true',
format: 'json' }));
req.end();
VB
POST/GET
Private Sub Command1_Click()
Dim DataToSend As String
Dim objXML As Object
Dim message As String
Dim authKey As String
Dim mobiles As String
Dim sender As String
Dim route As String
Dim URL As String
'Set these variables
auth_Key = "Your auth key";
mobiles = "9999999999";
'Sender ID,While using route4 sender id should be 6 characters long.
sender = "TESTIN";
' this url encode function may not work fully functional.
message = URLEncode(" Your message ")
'Define route
route = "default"
' do not use https
URL = "http://www.tripadasmsbox.com/api/sendapi.php?"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL , False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXML.send "auth_key=" + auth_Key + "&mobiles=" + mobiles + "&message=" + message + "&sender=" + sender + "&route=" + route
If Len(objXML.responseText) > 0 Then
MsgBox objXML.responseText
End If
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