A barebone SMS to email gateway can be written like this:
$mail_to = 'your name'; if (gnokii_open()) { $sms_memory = 'IN'; // 'IN', 'SM' for ($number = 1; $number <= 10; $number++) { $sms = gnokii_getsms($sms_memory, $number); if ($sms) { if (mail($mail_to, 'SMS from ' . $sms['remote'], $sms['text'])) { //gnokii_deletesms($sms_memory, $number); //commented out while testing } } } gnokii_close(); }
Comments
Please explain how to
Please explain how to include library files (such as include('./gnokii/gnokii_library.php'); that define functions such as gnokii_getsms() and gnokii_deletesms( in PHP). Can you also explain the variable $sms['remote']?
Your effort is greatly appreciated.
Charles
Functions like
Functions like gnokii_getsms() and gnokii_deletesms() are defined in the PHP extension I wrote.
On Linux it's a .so file that you need to add to php.ini along the other extensions (it should work on Windows too, as a .dll, but I haven't tried).
Sources for this extension are now in gnokii CVS at
http://cvs.savannah.gnu.org/viewvc/gnokii-extras/bindings/PHP/gnokii4php/?root=gnokii see the README for installation instructions and the ChangeLog to know what is implemented.