I just added gnokii_open() and gnokii_close().
gnokii_open() has two optional arguments, just like command line gnokii: path of config file and name of phone section
gnokii_close() is optional since PHP will close for you at the end of the script
Bug: a script can't open two phones at the same time because the second open will overwrite the pointer of the first one (I will implement a global pool).
Updated function list:
static function_entry gnokii_functions[] = {
PHP_FE(gnokii_open, NULL)
PHP_FE(gnokii_close, NULL)
PHP_FE(gnokii_identify, NULL)
PHP_FE(gnokii_lasterror, NULL)
PHP_FE(gnokii_version, NULL)
PHP_FE(gnokii_getsmsstatus, NULL)
PHP_FE(gnokii_getsms, NULL)
PHP_FE(gnokii_deletesms, NULL)
PHP_FE(gnokii_reset, NULL)
{NULL, NULL, NULL}
};
Comments
Dear Daniele, I have been
Dear Daniele,
I have been trying to write a php program to send sms through gsm mobile phone using gnokii. I need a sample php program to do that. Could you guide me in doing that?
Thanks.
Daniel
At the moment you can't send
At the moment you can't send an SMS only with PHP: there are too many options available with command line gnokii that wouldn't fit in the current design of the PHP extension.
If you need to send a single SMS or if the phone is not always connected, the best option is calling the gnokii executable using PHP's exec() using input redirection for message body.
If you need to send more than one message, consider using smsd either with one of the database modules (with PHP you simply have to do SQL INSERT) or with the file module (you just create a file in the configured spool directory) and smsd will try to send it. For the file module you may want to look at the smsd examples.