Create Your Own Free SMS Gateway API in PHP

FREE SMS API GATEWAY FOR DEVELOPERS CONNECT WITH JAVA, PHP, .NET, HTTP Scripts

Free SMS API With Sample Code

PHP Script

<?php
// Replace with your username
$user = "your_user_name";
// Replace with your API KEY (We have sent API KEY on activation email, also available on panel)
$password = "your_password";
// Replace with the destination mobile Number to which you want to send sms
$msisdn = "Mobile_no";
// Replace if you have your own Six character Sender ID, or check with our support team.
$sid = "SMSHUB";
// Replace with client name
$name = "Anurag Sharrma";
// Replace if you have OTP in your template.
$OTP = "6765R";
// Replace with your Message content
$msg = "Dear ram, Your OTP for cloudwireless.in is : 6547";
 $msg = urlencode($msg);

$fl = "0";
// if you are using transaction sms api then keep gwid = 2 or if promotional then remove this parameter
$gwid = "2";
// For Plain Text, use "txt" ; for Unicode symbols or regional Languages like hindi/tamil/kannada use "uni"
$type = "txt";

//--------------------------------------
//step1
$cSession = curl_init(); 
//step2
curl_setopt($cSession,CURLOPT_URL,"http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?
user=".$user."&password=".$password."&msisdn=".$msisdn."&sid=".$sid."&msg=".$msg."&fl=0&gwid=2");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false); 
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
//step5
echo $result;
?>

ASP Script

<%
'Set the values same as you use in your smsindiahub.in account
sUser = "user"
sPassword ="password"
'Set the mobile number on which you want to send SMS
sNumber = "91123456789"
‘Your Message
sMessage = “Test SMS from SMS INDIA HUB”
' You approved sender id
sSenderID = "WEBSMS"
Dim objXmlHttpMain , sURL
sURL="http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=" & sUser &
"&password=" & sPassword & "&msisdn=" & sNumber & "&sid=" & sSenderID &
"&msg=" & sMessage & "&fl=0"
Set objXmlHttpMain = Server.CreateObject("Msxml2.ServerXMLHTTP")
on error resume next
objXmlHttpMain.open "GET",sURL, False
objXmlHttpMain.setRequestHeader "Content-Type", "text/urlencoded"
objXmlHttpMain.send
‘Store response
response.Write (objXmlHttpMain.responseText)
%>
API Parameters:
user: Your login username.
password: Your login password.
msisdn: Single mobile number or multiple mobile numbers separated by comma(10 digits or +91).
sid: Approved sender id(Only 6 characters).
msg: Your message content(Minimum 459 characters/3 messages). Note: If you are using template
then edit only the dynamic part which is in ##Field##.
fl: if flash message then 1 or else 0
gwid: 2 (it’s for Transactions route.)
Note: For Transaction SMS Please add additional Parameter &gwid=2
Note: This is to update you that above code have been supplied to SMSINDIAHUB by clients. As such,
accuracy is not guaranteed by SMSINDIAHUB.

ASP.net(c#) Script

using System
using System.IO
using System.Net
using System.Text
using System.Web
string sUser = “USERNAME”;
string spwd = “PASSWORD”;
string sNumber = Session["Mobile"].ToString();
string sMessage = “Hi Thanks for Signing-up”;
string sSenderID = “WEBSMS”;
string sURL = “http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user
=” + sUser + “&password=” +
spwd + “&msisdn=” + sNumber + “&sid=” + sSenderID + “&msg=” + 
sMessage + “&fl=0?;
string sResponse = GetResponse(sURL);
Response.Write(sResponse);
public static string GetResponse(string sURL)
{
HttpWebRequest request = (HttpWebRequest)WebRequest
.Create(sURL);
request.MaximumAutomaticRedirections = 4;
request.Credentials = CredentialCache.DefaultCredentials;
try
{
HttpWebResponse response = (HttpWebResponse)request
.GetResponse();
Stream receiveStream = response.GetResponseStream(
);
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
string sResponse = readStream.ReadToEnd();
response.Close();
readStream.Close();
return sResponse;
}
catch
{
return “”;
}
}

VB.net Script

Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Partial Class _Default
 Inherits System.Web.UI.Page
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
 Dim sURL As String
 Dim objReader As StreamReader
 sURL
="http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=YourUserName&password=YourPassw
ord&msisdn=919898XXXXXX,919227XXXXXX&sid=WEBSMS&msg=Test SMS From SMSHUB&fl=0"

 Dim sResponse As WebRequest
 sResponse = WebRequest.Create(sURL)

 Try
 Dim objStream As Stream
 objStream = sResponse.GetResponse.GetResponseStream()
 objReader = New StreamReader(objStream)
 Response.Write(objReader.ReadToEnd())
 objReader.Close()
 Catch ex As Exception
 ex.Message

 End Try
 End Sub
End Class 
SMS INDIA HUB™
Mobile Marketing Solutions Worldwide
Cloud Wireless Technologies India Pvt. Ltd.
Plot Number 16, Rajat Business Chamber, Opp. GK Palace Hotel, MP Nagar Zone – II – Bhopal
Email: - sales@smsindiahub.in | accounts@smsindiahub.in | billing@smsindiahub.in | support@smsindiahub.in
API Parameters:
user: Your login username.
password: Your login password.
msisdn: Single mobile number or multiple mobile numbers separated by comma(10 digits or +91).
sid: Approved sender id(Only 6 characters).
msg: Your message content(Minimum 459 characters/3 messages). Note: If you are using template
then edit only the dynamic part which is in ##Field##.
fl: if flash message then 1 or else 0
gwid: 2 (it’s for Transactions route.)

Download

Java (New) Script

package javaapplication;
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 SMSINDIAHUB {
public static String retval="";

 public static String SMSSender(String user,String password,String msisdn,String msg,String sid,String fl)
 {
 String rsp="";

 try {
 // Construct The Post Data
 String data = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(user, "UTF-8");
 data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
 data += "&" + URLEncoder.encode("msisdn", "UTF-8") + "=" + URLEncoder.encode(msisdn, "UTF-8");
 data += "&" + URLEncoder.encode("msg", "UTF-8") + "=" + URLEncoder.encode(msg, "UTF-8");
 data += "&" + URLEncoder.encode("sid", "UTF-8") + "=" + URLEncoder.encode(sid, "UTF-8");
 data += "&" + URLEncoder.encode("fl", "UTF-8") + "=" + URLEncoder.encode(fl, "UTF-8");

 //Push the HTTP Request
 URL url = new URL("http://cloud.smsindiahub.in/vendorsms/pushsms.aspx");
 URLConnection conn = url.openConnection();
 conn.setDoOutput(true);

 OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
 wr.write(data);
 wr.flush();

 //Read The Response
 BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
 String line;
 while ((line = rd.readLine()) != null) {
 // Process line...
 retval += line;
 }
 wr.close();
 rd.close();

 System.out.println(retval);
 rsp = retval;

 } catch (Exception e) {
 e.printStackTrace();
 } 
SMS INDIA HUB™
Mobile Marketing Solutions Worldwide
Cloud Wireless Technologies India Pvt. Ltd.
Plot Number 16, Rajat Business Chamber, Opp. GK Palace Hotel, MP Nagar Zone – II – Bhopal
Email: - sales@smsindiahub.in | accounts@smsindiahub.in | billing@smsindiahub.in | support@smsindiahub.in
 return rsp;
 }

 public static void main(String[] args) {
 String response = SMSSender("username", "password", "918103857676", "message", "WEBSMS", "0");
 System.out.println(response);
 }
}
API Parameters:
user: Your login username.
password: Your login password.
msisdn: Single mobile number or multiple mobile numbers separated by comma(10 digits or +91).
sid: Approved sender id(Only 6 characters).
msg: Your message content(Minimum 459 characters/3 messages). Note: If you are using template then edit only
the dynamic part which is in ##Field##.
fl: if flash message then 1 or else 0
gwid: 2 (it’s for Transactions route.)
Note: For Transaction SMS Please add additional Parameter &gwid=2
Note: This is to update you that above code have been supplied to SMSINDIAHUB by clients. As such, accuracy is
not guaranteed by SMSINDIAHUB.package javaapplication;
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 SMSINDIAHUB {
public static String retval="";

 public static String SMSSender(String user,String password,String msisdn,String msg,String sid,String fl)
 {
 String rsp="";

 try {
 // Construct The Post Data
 String data = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(user, "UTF-8");
 data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
 data += "&" + URLEncoder.encode("msisdn", "UTF-8") + "=" + URLEncoder.encode(msisdn, "UTF-8");
 data += "&" + URLEncoder.encode("msg", "UTF-8") + "=" + URLEncoder.encode(msg, "UTF-8");
 data += "&" + URLEncoder.encode("sid", "UTF-8") + "=" + URLEncoder.encode(sid, "UTF-8");
 data += "&" + URLEncoder.encode("fl", "UTF-8") + "=" + URLEncoder.encode(fl, "UTF-8");

 //Push the HTTP Request
 URL url = new URL("http://cloud.smsindiahub.in/vendorsms/pushsms.aspx");
 URLConnection conn = url.openConnection();
 conn.setDoOutput(true);

 OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
 wr.write(data);
 wr.flush();

 //Read The Response
 BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
 String line;
 while ((line = rd.readLine()) != null) {
 // Process line...
 retval += line;
 }
 wr.close();
 rd.close();

 System.out.println(retval);
 rsp = retval;

 } catch (Exception e) {
 e.printStackTrace();
 } 
SMS INDIA HUB™
Mobile Marketing Solutions Worldwide
Cloud Wireless Technologies India Pvt. Ltd.
Plot Number 16, Rajat Business Chamber, Opp. GK Palace Hotel, MP Nagar Zone – II – Bhopal
Email: - sales@smsindiahub.in | accounts@smsindiahub.in | billing@smsindiahub.in | support@smsindiahub.in
 return rsp;
 }

 public static void main(String[] args) {
 String response = SMSSender("username", "password", "918103857676", "message", "WEBSMS", "0");
 System.out.println(response);
 }
}
API Parameters:
user: Your login username.
password: Your login password.
msisdn: Single mobile number or multiple mobile numbers separated by comma(10 digits or +91).
sid: Approved sender id(Only 6 characters).
msg: Your message content(Minimum 459 characters/3 messages). Note: If you are using template then edit only
the dynamic part which is in ##Field##.
fl: if flash message then 1 or else 0
gwid: 2 (it’s for Transactions route.)
Note: For Transaction SMS Please add additional Parameter &gwid=2
Note: This is to update you that above code have been supplied to SMSINDIAHUB by clients. As such, accuracy is
not guaranteed by SMSINDIAHUB.

Java (Old) Script

package javaapplication;
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 SMSINDIAHUB {
public static String retval="";

 public static String SMSSender(String user,String password,String msisdn,String msg,String sid,String fl)
 {
 String rsp="";

 try {
 // Construct The Post Data
 String data = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(user, "UTF-8");
 data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
 data += "&" + URLEncoder.encode("msisdn", "UTF-8") + "=" + URLEncoder.encode(msisdn, "UTF-8");
 data += "&" + URLEncoder.encode("msg", "UTF-8") + "=" + URLEncoder.encode(msg, "UTF-8");
 data += "&" + URLEncoder.encode("sid", "UTF-8") + "=" + URLEncoder.encode(sid, "UTF-8");
 data += "&" + URLEncoder.encode("fl", "UTF-8") + "=" + URLEncoder.encode(fl, "UTF-8");

 //Push the HTTP Request
 URL url = new URL("http://cloud.smsindiahub.in/vendorsms/pushsms.aspx");
 URLConnection conn = url.openConnection();
 conn.setDoOutput(true);

 OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
 wr.write(data);
 wr.flush();

 //Read The Response
 BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
 String line;
 while ((line = rd.readLine()) != null) {
 // Process line...
 retval += line;
 }
 wr.close();
 rd.close();

 System.out.println(retval);
 rsp = retval;

 } catch (Exception e) {
 e.printStackTrace();
 } 
SMS INDIA HUB™
Mobile Marketing Solutions Worldwide
Cloud Wireless Technologies India Pvt. Ltd.
Plot Number 16, Rajat Business Chamber, Opp. GK Palace Hotel, MP Nagar Zone – II – Bhopal
Email: - sales@smsindiahub.in | accounts@smsindiahub.in | billing@smsindiahub.in | support@smsindiahub.in
 return rsp;
 }

 public static void main(String[] args) {
 String response = SMSSender("username", "password", "918103857676", "message", "WEBSMS", "0");
 System.out.println(response);
 }
}
API Parameters:
user: Your login username.
password: Your login password.
msisdn: Single mobile number or multiple mobile numbers separated by comma(10 digits or +91).
sid: Approved sender id(Only 6 characters).
msg: Your message content(Minimum 459 characters/3 messages). Note: If you are using template then edit only
the dynamic part which is in ##Field##.
fl: if flash message then 1 or else 0
gwid: 2 (it’s for Transactions route.)
Note: For Transaction SMS Please add additional Parameter &gwid=2
Note: This is to update you that above code have been supplied to SMSINDIAHUB by clients. As such, accuracy is
not guaranteed by SMSINDIAHUB

SMPP API

Documentation of SMPP API

Voice OTP API

Transactional Otp Call : 

1.Call Originate :

Api Url: http://180.150.251.45:3334/api/otp/Call

Method : ContentType = "text/json";Method = "POST"; 

Body :
{"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "clientId": 
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "callerId": "0263090613","Number": "84xxxxxxxx",
"Pin": "123456","MediaFileToPlayBeforeOtp": "otpmessage.mp3", 
"RetryCount": 2, callType: 2}

Parameter Details:

apiKey: apiKey provided by user panel
clientId:clientId provided by user panel
Number:Number to which you want to call
MediaFileToPlayBeforeOtp: Media id received from media upload api
callType: 1/2 where 1=promotional and 2=transactional
RetryCount: Number of times to repeat pin
pin: pin number that you want to applay 

2.Api Response:

{"CorrelationId": "699f3416-25c7-480f-a7s3a-d1f19f32847f","IsSuccess": true,"Message": "","ErrorCode": 0} 

HTTP API

HTTP API Document

Unicode API Document

For Unicode Message:
Promotional Unicode Message API
http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=yourUserID&password=yourPassword&
msisdn=919898xxxxxx&sid=SenderId&msg=??????? ?????&fl=0&dc=8
Transactional Unicode Message API
http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=yourUserID&password=yourPassword&
msisdn=919898xxxxxx&sid=SenderId&msg=??????? ?????&fl=0&dc=8&gwid=2

International API Document

HTTP API to submit messages on SMPP :
http://:/bulksms/bulksms?
username=XXXX&password=YYYYY&type=Y&dlr=Z&destination=QQQQQQQQQ&sour
ce=RRRR&message=SSSSSSSS<&url=KKKK>
:XXX.XXX.XXX.XXX
:8080