<HTML>
<HEAD><TITLE>Send SMS Message</TITLE></HEAD>
<BODY><center>
<?php
//  Filename: smsExample.php
//  Author:   Charlie Boisseau  <http://www.boisseau.co.uk>
//                               charlie at boisseau dot co dot uk
//  Modified: 2nd April 2004
//  Purpose:  This is the front end for the 2SMS code.  It uses the
//            functions and class from the 2SMS.php file.

//            This code is completely free, however if you are
//            using it, I'd apreciate a post card, email or even
//            a donation (details for all three are available at
//            <http://www.boisseau.co.uk/>.

//  Make sure this file is included, and if it's not kept in the same
//  directory, you must update the following line to match it's
//  location:
include_once('2SMS.php');


//  Put your 2sms account username and password here:
$User "you@yourcompany.com";
$Pass "test";

//  Set the destination (phone number) and message strings.
$Dest $_REQUEST['Destination'];
$Msg $_REQUEST['Message'];

//  Make sure neither were empty.  If one or the other was, print an
//  error.  Otherwise call the sendSMS function from the 2SMS.php file.
if($Dest || $Msg) {
    if (!
$Dest) {
        echo 
"<font color=\"red\">Error: </font>Please supply a destination.<br.";
    } elseif (!
$Msg) {
        echo 
"<font color=\"red\">Error: </font>Please supply a message.<br>";
    } else {
        
$outputXML sendSMS($User$Pass$Dest$Msg);
    }
}

//  Check there was a response.
if ($outputXML != '') {
    
    
//  Create a new instance of our automatic XML parser, also from the
    //  2SMS.php file.  The single parameter is the XML response handed
    //  to us from the server.
    
$sx = new SimpleXML($outputXML);
    
    
//  Check the 'RESULT' tag, to see if the message was accepted.  If
    //  there was a problem, we print the error.  If there wasn't an
    //  error, we print the message id and credit levels found in the
    //  XML response.
    
    
$result $sx->record['RESULT'];
    if (
$result == "OK") {
        echo 
"Message sent to '"    .$sx->record['DESTINATION']    ."'.<br>\n";
        echo 
"Message ID '"            .$sx->record['MESSAGEID']    ."'.<br>\n";
        echo 
"You now have "        .$sx->record['CREDITS']        ." credits left.<br>\n";
    } else {
        echo 
"<font color=\"red\">"    .$sx->record['DESCRIPTION']    ."</font><br>\n";
    }
}

?>
<p><h2>Send SMS</h2></p>
<form method="post" action="sms.php"><table><tr>
<td align="right">Mobile No.:</td>
<td><input type="text" name="Destination" value="<? echo $Dest ?>"></td>
</tr><tr>
<td align="right">Message:</td>
<td><textarea name="Message" cols="30" rows="5"  ><? echo $Msg ?></textarea></td>
</tr><tr>
<td align="right" colspan="2"><input type="Submit" value="Send"></td>
</tr></table>
</form>  
</center>
</BODY>
</HTML>