Gnokii with CLI PHP
Linux Server August 18th, 2008I’ve been messing around with Gnokii, an open source program that communicates with mobile phone (mostly Nokia). Upon installing the Gnokii from source, I can fire up SMSD a daemon that listens for incoming messages from the phone and display them on the computer screen or save into a database program such as MySQL.
To make things more exciting, I slightly patch the SMSD source code to process PHP script when a message arrives. You can download my complete patched Gnokii here. First, compile the Gnokii from source. After that change destination into smsd folder and run again the usual configure, make and make install.
Example how to execute SMSD:
# ./smsd -m file -i 5 -a /usr/local/bin/php -e /tmp/test.php
test.php:
print_r($argv);Format
$argv[0] = PHP_PATH
$argv[1] = PHP_EXEC_FILE
$argv[2] = incoming number
$argv[3] = incoming message
As for the mobile phone, I use Nokia 6070 which being sold at forum.lowyat.net around RM265.


I also got the CA-42 Nokia cable from Lowyat Plaza for RM35


The complete Gnokii installation instruction can be found at Gnokii Wiki.
With this successfully installed, I can use the SMS, for example, to check on my server health or other cool stuff.


March 13th, 2009 at 12:59 am
Hi Fendy,
Thank you very much for your great post. I am interested in how to make smsd execute php command upon receiving new SMS.
I am using Trixbox - Asterisk server, and want to have this function. But to install your modified gnokii, there are a lot of dependencies needed on my server, which can not be satisfied.
The newest version of gnokii (0.6.27) works great on my server, and ofcouse, can not configure smsd to CLI PHP. I even traced your modified script (smsd.h, smsd.c), and tried to copy into newer version, but failed.
I wonder whether you could help me with the modified version 0.6.27, if it wont take a lot of your time.
My best regards & thanks,
Bao Nguyen.