Hi, Now send free sms from website or mobile to mobile number using site2sms gateway for free of cost. This script is made by the php programing scripting language. It is easy to integrate with your website or android app.
Let me give some specific requirements to enable this sms gateways script.
Requirements :
Register at Mashape.com and get the api key..
Download Unirest php library from git hub library (Click to download)
What is Mashape: Mashape is a world-class marketplace to consume, distribute, manage, and monitor both private and public APIs from developers all over the world.
What is Unirest.php library:
Unirest is a set of lightweight HTTP libraries available in multiple languages, ideal for most applications:
<form role="form" method="post" action="url to submit form to php script">
<input type="text" class="form-control" id="mobileno" name="txtUID" placeholder="Enter site2sms login id" required/>
<input type="password" class="form-control" id="pwd" name="txtUPwd" placeholder="Enter Site2sms Password" required/>
<input type="text" class="form-control" id="pwd" name="txtRMobno" placeholder="Enter Receiver Mobile Number" required/>
<textarea rows="5" cols="100" class="form-control" id="message" name="txtMsg" placeholder="Enter Message 140 Characters only"></textarea>
<input type="submit" class="btn btn-primary btn-lg btn-block" value="Submit" name="sub">
</form>
PHP code :
<?php
if(isset($_REQUEST['sub']))
{
require_once 'unirest-php-master/lib/Unirest.php';
$uid=$_REQUEST['txtUID'];
$phone=$_REQUEST['txtRMobno'];
$msg=$_REQUEST['txtMsg'];
$pwd=$_REQUEST['txtUPwd'];
// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest::get("https://site2sms.p.mashape.com/index.php?msg=$msg&phone=$phone&pwd=$pwd&uid=$uid",
array(
"X-Mashape-Key" => "get the key from mashape and replace here"
)
);
//echo json_encode($response->body);
if($response->body->response)
echo $response->body->response." Message Has been sent successfully ";
else
echo "<font color='red'>Invalid Login details</font>";
}
?>
Let me give some specific requirements to enable this sms gateways script.
Requirements :
Register at Mashape.com and get the api key..
Download Unirest php library from git hub library (Click to download)
What is Mashape: Mashape is a world-class marketplace to consume, distribute, manage, and monitor both private and public APIs from developers all over the world.
What is Unirest.php library:
Unirest is a set of lightweight HTTP libraries available in multiple languages, ideal for most applications:
- Make
GET
,POST
,PUT
,PATCH
,DELETE
requests - It supports form parameters, file uploads and custom body entities
- Supports gzip
- Supports Basic Authentication natively
- Customizable timeout
- Customizable default headers for every request (DRY)
- Automatic JSON parsing into a native object for JSON responses
<form role="form" method="post" action="url to submit form to php script">
<input type="text" class="form-control" id="mobileno" name="txtUID" placeholder="Enter site2sms login id" required/>
<input type="password" class="form-control" id="pwd" name="txtUPwd" placeholder="Enter Site2sms Password" required/>
<input type="text" class="form-control" id="pwd" name="txtRMobno" placeholder="Enter Receiver Mobile Number" required/>
<textarea rows="5" cols="100" class="form-control" id="message" name="txtMsg" placeholder="Enter Message 140 Characters only"></textarea>
<input type="submit" class="btn btn-primary btn-lg btn-block" value="Submit" name="sub">
</form>
PHP code :
<?php
if(isset($_REQUEST['sub']))
{
require_once 'unirest-php-master/lib/Unirest.php';
$uid=$_REQUEST['txtUID'];
$phone=$_REQUEST['txtRMobno'];
$msg=$_REQUEST['txtMsg'];
$pwd=$_REQUEST['txtUPwd'];
// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest::get("https://site2sms.p.mashape.com/index.php?msg=$msg&phone=$phone&pwd=$pwd&uid=$uid",
array(
"X-Mashape-Key" => "get the key from mashape and replace here"
)
);
//echo json_encode($response->body);
if($response->body->response)
echo $response->body->response." Message Has been sent successfully ";
else
echo "<font color='red'>Invalid Login details</font>";
}
?>
0 comments:
Post a Comment