SMS Server Tools 3 is a great little SMS Gateway software which you can pair up nicely with some PHP scripts in order to send and receive SMSes.

Today’s little trick shows you how to send a blank (i.e. no text body) SMS using a PHP script to generate the outgoing spool file.

//$body is SMS text body | $phone is number being sent to
$handle = fopen('/var/spool/sms/outgoing/filesendname, "w");
$body = stripslashes(urldecode($body));
fputs($handle, "To: +$phonen");
fputs($handle, "Alphabet: ISO8859-15n");
fputs($handle, "n");
if (strlen($body) > 0)
{
    fputs($handle, "$body");
}
else
{
    fputs($handle, "n");
}
fclose($handle);

What the script does is actually pretty simple at heart. The first step is to create a new file handle in which to store the SMS contents, this file being created in the outgoing spool folder specified by your SMS3 configuration. Then you simply insert the correct text into the file, ensuring you keep strictly to the format used in the example above. The only little trick is that in order for it to process correctly when it comes to blank SMSes, you need to insert a new line n character to replace what would have been the SMS body.

And Bob’s your uncle.

Related Link: http://smstools3.kekekasvi.com/