FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Php sms





garf
Code:
<html>
<body>

<?php
// sms.php
// -------------------------------------------
// Author   : Harry Sufehmi
// Date      : 3nd January 2003
// -------------------------------------------
// Truesenses.com have a feature where Incoming SMS can be forwarded to email and/or a URL
// If you set it to be forwarded to a URL, this script will enable you to forward it again
// directly to your handphone. Very convenient.
// It will cost your credit, but if you need convenience, this script will help.
// Also you can use this script to send SMS from your mobile using Truesenses (instead of your own SMSC),
// by sending SMS to 0041793816010 and formatted the message as:
//   "<your_keyword> FW <destination_number> <your_message>"
// Very useful when your provider's SMSC is unreliable / have poor coverage (like mine)
// -------------------------------------------
// Requirements:
//
// [ 1 ] Have curl (and its SSL libraries)in the same directory as the script
// (as mentioned in http://www.truesenses.com/cgi-bin/smsgateway.cgi?function=buildpage&page=public_help)
//
// [ 2 ] Have enabled forwarding Incoming SMS to a URL with HTTP POST (not GET) - do this from your Truesenses Admin page
//
// [ 3 ] And have enabled access to HTTP gateway from your host - do this from your Truesenses Admin page
//      (I was stuck and it was because I forgot to enable this)
//
// [ 4 ] And, of course, have this script hosted somewhere on the Internet.
// -------------------------------------------
// Some variables needs to be modified, such as you account number, your password, etc.
// It should be pretty clear which ones to change.
// -------------------------------------------

$account = "put your account name here";
$password = "put your account's password here";
$your_mobile = "put your mobile number here";


function myAddSlashes($st) {         // this function will get rid of extraneous slashes - which may or may not occur, depending on your server's magic_quote setting
if (get_magic_quotes_gpc()==1) {
return StripSlashes($st);
} else {
return AddSlashes($st);
}
}

// Check whether to forward to $your_mobile, or to another number
// by looking for existence of "FW" string inside the message

if (ereg("FW", $MESSAGE)) {               // if keyword FW exist, then you're using this script to send SMS from your mobile via Truesenses

   $exploded_MESSAGE = explode(" ", $MESSAGE);       // break up the $MESSAGE into words   

   $new_NUMBER = $exploded_MESSAGE[2];            // get the destination's mobile number

   // find the position of the first word of the message
   $firstword_pos = strpos($MESSAGE, $exploded_MESSAGE[3]);
   $new_MESSAGE = myAddSlashes(substr($MESSAGE, $firstword_pos));   // extract the whole message

   $URL="secure.simmcomm.ch/cgi-bin/smsgateway.cgi";
   exec("curl -d \"ACCOUNT=$account&PASSWORD=$password&NUMBER=$new_NUMBER&MESSAGE=$new_MESSAGE&ORIGIN=0041793816010&CMD=SENDMESSAGE\" https://$URL",$return_message_array, $return_number);

   // the following 2 lines are here for debugging purposes only, un-comment them if you wish to debug this script
   //   echo "new_NUMBER: ".$new_NUMBER."\n\rnew_MESSAGE: ".$new_MESSAGE."\n\r\n\r";
   //   echo "ACCOUNT=".$account."&PASSWORD=".$password."&NUMBER=".$new_NUMBER."&MESSAGE=".$new_MESSAGE."&ORIGIN=0041793816010&CMD=SENDMESSAGE";

}
else
{
   // Just forward that Incoming SMS to your mobile phone

   $URL="secure.simmcomm.ch/cgi-bin/smsgateway.cgi";
   exec("curl -d \"ACCOUNT=$account&PASSWORD=$password&NUMBER=$your_mobile&MESSAGE=$MESSAGE&ORIGIN=$NUMBER&CMD=SENDMESSAGE\" https://$URL",$return_message_array, $return_number);

};

?>

</body>
</html>
Related topics
Marketplejs.
Sending Sms to mobile phones
make it better sms follow up server test
Post Free working SMS sites .....
SMS Sender
Pretty nifty language translation tool
Dzwonki/sygnaly sms wlasnej produkcji
COM port programming using PHP
Skrypt w PHP do wysylania SMS-ów
SMS Gateway
Sending SMS messages
How to store sms in database and use it
help me please with my problem
SMS with PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.