FW " // 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 = "your account here"; $password = "your password here"; $your_mobile = "your mobile number here"; function myAddSlashes($st) { 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 handphone $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); }; ?>