SMS Gateway API

How to implement SMS feature to our project? How can I add SMS feature in my shopping site? How can I send billing SMS reminder through my inventory project? How can I send OTP SMS verification using my project? These are the questions received from many students. Yes..,, We can add SMS feature in our project using SMS Gateway API.

SMS Gateway API

Using SMS payment gateway API user can send OTP SMS, Transactional SMS, Promotional SMS, Voice SMS, etc. There are a number of SMS providers who offer SMS gateway services. But none of the SMS providers free SMS API because SMS providers has to pay to mobile operators. Following are the sample SMS integration code. You can refer this and integrate to your project.

Web HTTP API:

smsc.co.in/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=xx

ASP.NET SMS API Code:

string strUrl =  "smsc.co.in/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=xx"; 
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(); 
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader( s );
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();

VB.NET SMS API code:

Dim strUrl As String
Dim strResp As String
strUrl = smsc.co.in/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=xx
strResp = DoWebRequest(strUrl)
End Sub
'Do web Request Function
Public Function DoWebRequest(url) As String
On Error GoTo err_DoWebRequest
Dim objXML As Object
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET", url, False
objXML.Send
If (objXML.Status = 404) Then
DoWebRequest = "404 Error"
Else
DoWebRequest = objXML.ResponseText
End If
Set objXML = Nothing
Exit Function

err_DoWebRequest:
DoWebRequest = "ERROR"
Exit Function
End Function

PHP SMS API code:

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,  "smsc.co.in/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=xx";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$sender
ID&receipientno=$receipientno&cid=$cid&msgtxt=$msgtxt");
$buffer = curl_exec($ch);
if(empty ($buffer))
{ echo " buffer is empty "; }
else
{ echo $buffer; } 
curl_close($ch);

Apply for Free SMS API:

We provide free SMS package with API. Simply register for an account, and you will automatically receive 20 free SMS credits to try our service. You can use this for eduction, ecommerce, healthcare, real estate, financial service, inventory, food order projects. Kindly fill the following form and we send you login credentials and integration details by mail.

API Preview:

Please note: This works only for India.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.