Sunday, August 5, 2012

Alfasms API 2012




You can also send a GET/POST request to



http://www.alfredfrancis.in/alfasmsapi?uname=YOUR_USERNAME&pass=YOUR_PASSWORD&to=YOUR_RECEPTIANT&mess=YOUR_MESSAGE&gateway=YOUR_GATEWAY  

Supported gateways : way2sms/fullonsms/160by2/sms440/smsfi/indiarocks/freesms8/bhokalisms/smsabc/site2sms

>> Where YOUR_USERNAME your way2sms/fullonsms/160by2/sms440/smsfi/indiarocks/freesms8/bhokalisms/smsabc/site2sms USERNAME(ie mobile number)
>>Where YOUR_PASSWORD your gateway PASSWORD.
>> Where YOUR_RECEPTIANT is to which number you want to send SMS.
>> Where YOUR_MESSAGE is the message you want to send.
>> Where YOUR_GATEWAY is way2sms/fullonsms/160by2/sms440/smsfi/indiarocks/freesms8/bhokalisms/smsabc/site2sms.

The script will return

 1 if SMS sent
-1 ifsome server error
-2 if invalid username
-3 if invalid message text
-4 if login failed.

Example

<?php
$sms = file_get_contents('http://www.alfredfrancis.in/alfasmsapi/?uname=80896*****pass=******&to=8714349616&mess=It works&gateway=way2sms');
echo $sms;
?>

REQUIREMENTS ??

  • Server with PHP and cURL(No need of cURL, if online version)
  • Basic knowledge in PHP
  • A valid way2sms/160by2/fullonsms account
  • A working brain…

HOW TO USE ??

Simply download and extract the contents of the zip files into a folder.

Online version->


<?php
include("alfa.sms.php");
$result=alfasms("receptiant_mobile_number","Message");
 if($result==true)
{
echo "Message sent !";
}
else
{
echo $error;
}
?>

standalone version->

Example:


<?php
include_once "alfa.sms.class.php";
$sms=new AlfaSMS();
if($sms->login('username','password')
{
if($sms->send('8089617433','Thanks Alfred,your API works perfectly.'))
{
echo "SMS delivered sucessfully ! ";
}
else
{
echo "Ooopz ! Invalid content or mobile number .";
}
}
else
{
echo "Login error: Check your username and password";
}
$sms->logout();
?>

Example : Group sms->


<?php
include_once "alfa.sms.class.php";
$sms=new AlfaSMS();
$sms->login('username','password');
$text_message = "Hi Guys Alfred is Here ";
$phone_nos = array("8089617433","94********","**********","98******","94********");
foreach($phone_nos as $phone_no)
{
if($sms->send($phone_no,$text_message))
{
echo "SMS sent sucessfully to $phone_no”;
}
}
$sms->logout();
?>

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I too am facing the same error...
    Logging in..
    Sending SMS..
    Cant send SMS,Invalid content or Mobile number !
    Logging out ...

    ReplyDelete