< ?php
//Your authentication key
$authKey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
$mobileNumber = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
$senderId = "102234";
//Your message to send, Add URL encoding here.
$message = urlencode("Test message");
//Define route
$route = "default";
//Prepare you post parameters
$postData = array(
'authkey' => $authKey,
'mobiles' => $mobileNumber,
'message' => $message,
'sender' => $senderId,
'route' => $route
);
//API URL
$url="http://divishaitsolutions.in/api/sendhttp.php";
// init the resource
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData
//,CURLOPT_FOLLOWLOCATION => true
));
//Ignore SSL certificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//get response
$output = curl_exec($ch);
//Print error if any
if(curl_errno($ch))
{
echo 'error:' . curl_error($ch);
}
curl_close($ch);
echo $output;
?>
import urllib # Python URL functions
import urllib2 # Python URL functions
authkey = "YourAuthKey" # Your authentication key.
mobiles = "9999999999" # Multiple mobiles numbers separated by comma.
message = "Test message" # Your message to send.
sender = "112233" # Sender ID,While using route4 sender id should be 6 characters long.
route = "default" # Define route
# Prepare you post parameters
values = {
'authkey' : authkey,
'mobiles' : mobiles,
'message' : message,
'sender' : sender,
'route' : route
}
url = "http://divishaitsolutions.in/api/sendhttp.php" # API URL
postdata = urllib.urlencode(values) # URL encoding the data here.
req = urllib2.Request(url, postdata)
response = urllib2.urlopen(req)
output = response.read() # Get Response
print output # Print Response
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class SendSms{
public static void main(String[] args)
{
//Your authentication key
String authkey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
String mobiles = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
String senderId = "102234";
//Your message to send, Add URL encoding here.
String message = "Test message";
//define route
String route="default";
//Prepare Url
URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;
//encoding message
String encoded_message=URLEncoder.encode(message);
//Send SMS API
String mainUrl="http://divishaitsolutions.in/api/sendhttp.php?";
//Prepare parameter string
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("authkey="+authkey);
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
System.out.println(response);
//finally close connection
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
//Your authentication key
string authKey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
string mobileNumber = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
string senderId = "102234";
//Your message to send, Add URL encoding here.
string message = HttpUtility.UrlEncode("Test message");
//Prepare you post parameters
StringBuilder sbPostData = new StringBuilder();
sbPostData.AppendFormat("authkey={0}", authKey);
sbPostData.AppendFormat("&mobiles={0}", mobileNumber);
sbPostData.AppendFormat("&message={0}", message);
sbPostData.AppendFormat("&sender={0}", senderId);
sbPostData.AppendFormat("&route={0}", "default");
try
{
//Call Send SMS API
string sendSMSUri = "http://divishaitsolutions.in/api/sendhttp.php";
//Create HTTPWebrequest
HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri);
//Prepare and Add URL Encoded data
UTF8Encoding encoding = new UTF8Encoding();
byte[] data = encoding.GetBytes(sbPostData.ToString());
//Specify post method
httpWReq.Method = "POST";
httpWReq.ContentType = "application/x-www-form-urlencoded";
httpWReq.ContentLength = data.Length;
using (Stream stream = httpWReq.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
//Get the response
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseString = reader.ReadToEnd();
//Close the response
reader.Close();
response.Close();
}
catch (SystemException ex)
{
MessageBox.Show(ex.Message.ToString());
}
try
{
string strResult = "";
//Prepare you post parameters
var postValues = new List>();
//Your authentication key
postValues.Add(new KeyValuePair("authkey", "YourAuthKey"));
//Multiple mobiles numbers separated by comma
postValues.Add(new KeyValuePair("mobiles", "9999999"));
//Sender ID,While using route4 sender id should be 6 characters long.
postValues.Add(new KeyValuePair("sender", "102234"));
//Your message to send, Add URL encoding here.
string message = HttpUtility.UrlEncode("Test message");
postValues.Add(new KeyValuePair("message", message));
//Select route
postValues.Add(new KeyValuePair("route","default"));
//Prepare API to send SMS
Uri requesturl = new Uri("http://divishaitsolutions.in/api/sendhttp.php");
//create httpclient request
var httpClient = new HttpClient();
var httpContent = new HttpRequestMessage(HttpMethod.Post, requesturl);
httpContent.Headers.ExpectContinue = false;
httpContent.Content = new FormUrlEncodedContent(postValues);
HttpResponseMessage response = await httpClient.SendAsync(httpContent);
//Get response
var result = await response.Content.ReadAsStringAsync();
strResult = result.ToString();
response.Dispose();
httpClient.Dispose();
httpContent.Dispose();
}
catch (Exception ex)
{
throw ex;
}
//Your authentication key
String authkey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
String mobiles = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
String senderId = "102234";
//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="http://divishaitsolutions.in/api/sendhttp.php?";
//Prepare parameter string
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("authkey="+authkey);
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();
}
//write this code in your .gs file
//Your authentication key
var authKey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
var mobileNumber = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
var senderId = "102234";
//Your message to send, Add URL encoding here.
var message = "Test message";
//Define route
var route = "default";
var payload = {
"authkey": authKey,
'mobiles' : mobileNumber,
'message' : message,
'sender' : senderId,
'route' : route
};
var options = {
"method": "post",
"payload": payload
};
var res = UrlFetchApp.fetch("http://divishaitsolutions.in/api/sendhttp.php?", options);
var resAsTxt = '' + res + '';
Logger.log(resAsTxt)