Sending SMS using PHP,HTML PHP SMS Sending code download , php send SMS using php sample code example to send sms ,php SMS sending example code,php Send SMS tutorial, php send SMS script,send sms to mobile using php code download,send sms code in html,java code to send sms,java code to send sms using way2sms, java code to send sms from pc to mobile using internet,Sending SMS using Asp.net,HTML Asp.net SMS Sending code download , php send SMS using Asp.net sample code example to send sms ,Asp.net SMS sending example code,Asp.net Send SMS tutorial, Asp.net send SMS script,send sms to mobile using Asp.net code download,send sms code in html,java code to send sms,java code to send sms using way2sms,java code to send sms from pc to mobile using internet,Sending SMS using java,HTML java SMS Sending code download , php send SMS using java sample code example to send sms ,java SMS sending example code,java Send SMS tutorial, java send SMS script,send sms to mobile using java code download,Sending SMS using jsp,HTML jsp SMS Sending code download , php send SMS using jsp sample code example to send sms ,jsp SMS sending example code,jsp Send SMS tutorial, jsp send SMS script,send sms to mobile using jsp code download,Sending SMS using ASP,HTML ASP SMS Sending code download , php send SMS using ASP sample code example to send sms ,ASP SMS sending example code,ASP Send SMS tutorial, ASP send SMS script,send sms to mobile using ASP code download,Sending SMS using VB.net,HTML VB.net SMS Sending code download , php send SMS using VB.net sample code example to send sms ,VB.net SMS sending example code,VB.net Send SMS tutorial, VB.net send SMS script,send sms to mobile using VB.net code download,Sending SMS using C#.net,HTML C#.net SMS Sending code download , php send SMS using C#.net sample code example to send sms ,C#.net SMS sending example code,C#.net Send SMS tutorial, C#.net send SMS script,send sms to mobile using C#.net code download,
From last few months i was finding solution regarding SMS sending code . but really happy when i found the solution . it is not to much difficult rather very easy to send sms from your PC to any mobile.
You can use any Programming language for sending a sms Programming languages like PHP, JSP, ASP.net, C#.net, Java for sending SMS
Following Are the Steps
Step 1 : You must have your account with SMS Provider their are lots of website are available on internet which provide you bulk SMS Packages like Ahmednagarcity.in , (you can contact )is one
you need to create your account and Purchase SMS Plackage .
Step 2: You will get Username and Password after registration and SMS Package .
Step 3. their is a developer Tool which is available in every sms Providers side where you will get sample code as per the your requirement .
Step 4: You need to generate Authentication Key OR Secret Key By Login to your Account which will be used in code
Following is a Sample SMS Sending code Using PHP
<?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://54.254.154.166/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;
?>
Following is a Sample SMS Sending code Using JAVA
//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://54.254.154.166/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();
}
Following is a Sample SMS Sending code Using C#.net
//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://54.254.154.166/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());
}
Following is a Sample SMS Sending code Using VB.net/ VB6
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
authKey = "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://54.254.154.166/api/sendhttp.php?"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL , False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXML.send "authkey=" + authKey + "&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