Bulk SMS Api
Bulk SMS Api
Page 1
Contents
Check Balance……………………………………………………………….…6
Sample Codes
3.JAVA CODE………………………………………………………………………………9
4.PHP CODE…………………………………………………………………………….…11
Page 2
API single message to single recipient
User Name loginId This is the userId which you select at the time of
registration
Password Password Password
Sender Senderid You may have multiple senderIds at website but you
need to choose one
Sendto 9811xxxxxx,9812xxxxxx Write comma separated,10 digit mobile numbers. You
can send at the most 200 numbers in one go.
Message The text you want to send The text you want to send.
http://www.yourdomain.com/api/swsendSingle.asp?username=xxxx&password=xxxx&sender=sender
Id&sendto=919xxxx&message=hello
Page 3
API single message to multiple recipient
User Name loginId This is the userId which you select at the time of
registration
Message The text you want to send The text you want to send.
http://www.yourdomain.com/api/swsend.asp?username=xxxx&password=xxxx&sender=senderId&se
ndto=919xxxx,919xxxx&message=hello
Page 4
To get the LIVE delivery report
User Name loginId This is the userId which you select at the time of registration
Sendto 9811xxxxxx,9812xxxxxx Write comma separated,10 digit mobile numbers. You can send at
the most 200 numbers in one go.
Message The text you want to send The text you want to send.
dlrUrl The url where you want to http://yourServer_Url?logID=$logID$%26phNo=$phNO$%26resu
receive the delivery reports. lt=$result$
The Text after (?) (the query String) wll remain same for all.
Finally the complete url to send SMS with delivery report will look something like :
http://www.yourdomain.com/api/swsend.asp?username=xxxx&password=xxxx&sender=senderId&se
ndto=919xxxx,919xxxx&message=hello&dlrUrl=http://yourServer_Url?logID=$logID$%26phNo=$p
hNO$%26result=$result$
Page 5
Check Balance
User Name loginId This is the userId which you select at the time of registration
http://www.yourdomain.com/api/checkbalance.asp?username=xxxx&password=xxxx
Page 6
1.ASP.NET (C#) CODE
String varUserName=username;
String varPWD=password;
String varSenderID=senderID;
String varPhNo=”9811xxxxxx,9812xxxxxx”;
String
varUrl=”http://www.yourdomain.com/api/swsend.asp?username=”+varUserName+“&password=”+va
rPWD+”&sender=”+varSenderID+“&sendto=”+varPhNo+“&message=”+varMSG;
WebClientwc=new WebClient();
String responseFromServer=wc.DownloadString(varUrl);
Page 7
2.ASP CLASSIC CODE
varUserName=username
varPWD=password
varSenderID=senderID
varPhNo=”9811xxxxxx,9812xxxxxx”
varMSG=”message to send”
varUrl=”http://www.yourdomain.com/api/swsend.asp?username=”&varUserName& “&password=”
&varPWD& ”&sender=” &varSenderID& “&sendto=” &varPhNo& “&message=” &varMSG
objXmlhttp.send(NULL)
responseFromServer=objXmlHttp.responseText
response.write responseFromServer
Page 8
3.JAVA CODE
importjava.io.BufferedReader;
importjava.io.InputStreamReader;
importjava.io.OutputStreamWriter;
importjava.net.HttpURLConnection;
import java.net.URL;
importjava.net.URLEncoder;
importjava.util.Date;
{ try {
varUserName=username
varPWD=password
varSenderID=senderID
varPhNo=”9811xxxxxx,9812xxxxxx”
varMSG=”message to send”
varUrl=”http://www.yourdomain.com/api/swsend.asp?username=”+varUserName+“&password=”+va
rPWD+”&sender=”+varSenderID+“&sendto=”+varPhNo+“&message=”+varMSG
conn.setRequestMethod("GET");
conn.setDoOutput(true);
conn.setDoInput(true);
Page 9
conn.setUseCaches(false);
conn.connect();
String line;
buffer.append(line).append("\n");}
System.out.println(buffer.toString());
rd.close();
conn.disconnect();}
catch(Exception e)
{e.printStackTrace();}
}}
Note: Required javax.servlet.jar and jdom.jar to execute ( downloadable from internet,add toclasspath
).
Page 10
4.PHP CODE
$varUserName=username
$varPWD=password
$varSenderID=senderID
$varPhNo=”9811xxxxxx,9812xxxxxx”
$varMSG=”message to send”
$url=" http://www.yourdomain.com/api/swsend.asp";
$data="username=”.$varUserName.“&password=”.$varPWD.”&sender=”.$varSenderID.“&sendto=”.
$varPhNo.“&message=”.$varMSG;
postData($url,$data);
functionpostdata($url,$data)
$objURL = curl_init($url);
curl_setopt($objURL,CURLOPT_POST,1);
curl_setopt($objURL, CURLOPT_POSTFIELDS,$data);
$retval = trim(curl_exec($objURL));
curl_close($objURL);
return $retval;
Page 11
5. MS SQL CODE
DECLARE @objint
SET @msgTextTemp=REPLACE(@msgTextTemp,'&','%26')
SET @msgTextTemp=REPLACE(@msgTextTemp,'%','%25')
SET @msgTextTemp=REPLACE(@msgTextTemp,CHAR(13),CHAR(10))
SET
@URL=http://www.yourdomain.com/api/swsend.asp?username=xxxx&password=xxxx&sender=##se
nderID##&sendto=##phNo##&message=##msg##
SET @URL=replace(@URL,'##phNo##',@phNo)
SET @URL=replace(@URL,'##senderID##',@senderID)
SET @URL=replace(@URL,'##msg##',@msgTextTemp)
PRINT @response
Page 12