MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
Moderators: Moderators
Forum RSS feedReply
how do i code SMS Gateway API with memHT?
AuthorText
hushar
Junior Member
Avatar

Posts: 14
Contributes: 2

Gender: _NEUTRAL_
Online: No
Date: 02/10/2008 12:41
how do i code SMS Gateway API with memHT?
#post12871
Hello Friends,
I'm seeking for helping hand for building SMS Gateway API Script that will co-exists with

SS and able to send User Input (ie. Sender, PhoneNumber(international format), Message Text,

Message Type (Text only/Flash SMS etc.) using SS to SMS Gateway API @ sms.alertzap.com.

here is copy of PHP Script which has to be worked with SS.
( I have purchased one bulk sms pack from alertzap.com in php script i'm going to have my

account details. later on when user will post info this script should send URL to sms

gateway @ sms.alertzap.com

code

(e.g. http://sms.alertzap.com/sendsmsv2.asp?user=username&password=mypassword&sender=Internet&sendercdma=919860609000&text=This+is+a+sample+sms&PhoneNumber=919822012345,919370119223&track=1)
 


code

<?php
$sndr = '';
$phonenum ='';
$message = '';
$sndr = $_POST['sender'];
$phonenum = $_POST['PhoneNumber'];
$message = $_POST['text'];

$res = sendsms ($sndr,$phonenum,$message);

   
// Call this function when ever you wish to Send SMS
function sendsms($sndr,$mobile,$text)
   {
   $host = "sms.alertzap.com";
   $request = "";                //initialize the request variable
   $param["user"] = "username";       //   this is the username of your SMS

account
   $param["password"] = "password";    //this is the password of our SMS account
   $param["text"] = substr($text,0,159);    //this is the message that we want to send
   $param["PhoneNumber"] = $mobile;       //these are the recipients of the

message
   $tmp=substr($mobile,0,4);
   
   if ($tmp=="9198" || $tmp=="9194" || $tmp=="9199" || $tmp=="9192" || $tmp=="9197")
      {
      if ($sndr != NULL)
      $sender = $sndr;
      else
      $sender = "SwiftGet.net";         // SenderID for GSM and TATA
      }
   else
      $sender= "919860609000";      // SenderID for CDMA (Reliance0
     
   $param["sender"] = $sender;
   $param["track"] = "1";
     
   foreach($param as $key=>$val)    // Traverse through each member of the param array
      {
       $request.= $key."=".urlencode($val); //we have to urlencode the values
       $request.= "&"; //append the ampersand (&) sign after each paramter/value

pair
      }
   $request = substr($request, 0, strlen($request)-1); //remove the final ampersand

sign from the request
   $script = "/sendsmsv2.asp";
   $request_length = strlen($request);
   $method = "POST";
//   if ($method == "GET")
//      {
      //$script .= "?$request";
//      }
   //Now comes the header which we are going to post.
   $header = "$method $script HTTP/1.1rn";
   $header .= "Host: $hostrn";
   $header .= "Content-Type: application/x-www-form-urlencodedrn";
   $header .= "Content-Length: $request_lengthrn";
   $header .= "Connection: closernrn";
   $header .= "$requestrn";

   //Now we open up the connection
   $socket = @fsockopen($host, 80, $errno, $errstr);
   if ($socket) //if its open, then...
      {
       fputs($socket, $header); // send the details over
       while(!feof($socket))
          {
         $output=$output.fgets($socket); //get the results
          }
       fclose($socket);
      }

   $pos=strpos($output,"Submitted");
   if ($pos===false)
      return(0); // SMS Not Successful
   else
      return(1); // SMS Was successful
   }

   //Check Result of Sending SMS
   if ($res==1)
   {
   echo "SMS to $phonenum was successful...";
   echo "$track";
   }
   else
   {
   echo "SMS to $phonenum was not successful...";
   }

?>
 


SMS Gateway API As follows:

The post either via GET or POST needs to be done on

http://sms.alertzap.com/sendsmsv2.asp

The variables to be used are:

user -> Your username on the website

password -> Your password on the website

sender -> Alphanumeric/Number SenderID from your approved list of SenderID's to be used for GSM Recipients

sendercdma -> Number SenderID from your approved list of SenderID's to be used for CDMA Recipients

PhoneNumber -> Mobile number of the recipients. for multiple recipients enter numbers seperated by comma.

group -> (optional) The name of the group you wish to send message to. (Groups can be created and managed on the alertzap.com website.)

text -> The text of the message. (Charged 1 unit for 160 characters per recipient.)

flash = 1/0 -> (1) If the message should flash directly on the screen/(0)For standard SMS.

track = 1 -> if you wish to Track the delivery status of the message. (Optional)

A sample post to send sms would be like

Simple Text Messages:
code

http://sms.alertzap.com/sendsmsv2.asp?user=username&password=mypassword&sender=Internet&sendercdma=919860609000&text=This+is+a+sample+sms&PhoneNumber=919822012345,919370119223&track=1
 


Output:
Message Submitted
Credits Consumed: 2
Balance Credits: 98
Mobile=919822012345 MsgId=1177855328
Mobile=919370119223 MsgId=1177855329

--------------------------------------------

Features Expected:
1] i want to give registered users to send SMS thro this script.
2] i want to keep copy of every sms in database with username. (optional)
3] i want to count every users total message count. (160 chars par sms)

Please someone help me out..
I want to setup free sms service for my small community.

Thank you very much for your precious time.. :)
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 4642
Contributes: 1949

Gender: _MALE_
Online: No
Date: 02/10/2008 16:30
Re: how do i code SMS Gateway API with memHT?
#post12878
Built an addon like you do with a stand alone script. Follow instructions from the author of the script, he has probably an example somewhere.
Delete Edit Quote
 
subject-28
Senior Member
Avatar

Posts: 158
Contributes: 158

Gender: _NEUTRAL_
Online: No
Date: 02/10/2008 17:00
Re: how do i code SMS Gateway API with memHT?
#post12880
We provide sample source codes in ASP / ASP.net / PHP / VB to submit messages using simple function calls. Please Contact Us to obtain the sample source code.

That explains it all.

You can easily make a block with a login/password/stats use a script to submit the cred and receive something back whatever you get back gets printed on the screen. Pretty easy if I cared enough to work with it but i'll leave it to you Smile
Edited: 02/10/2008 17:16
Delete Edit Quote
 
Reply
Tags Cloud
Advertising
News Archive
Language
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.103.63.59

Username
Password
New files
MemHT Wiki
Friends
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo