SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu Apr 25, 2024 07:18
SMSTools3 Community » Help and support Bottom

[answered] How to call a php script with eventhandler ?

  This topic is locked

Page:  1

Author Post
Member
Registered:
Aug 2010
Location: beijing, China
Operating system name and version: linux
Version of smsd: 3.1.6
Smsd installed from: sources
Name and model of a modem / phone:
Interface: serial

in smsd.conf , i write
eventhandler = /usr/local/php/bin/php -f /data0/apache/share/htdocs/html/ev.php

it seems that the script does not work .

I read the manual about 'eventhandler' , it says the script that will execute whenever a message was sent, received or failed.

my question is ;

1, How can I catch the exact event , for example ,i just want to catch the 'sent' event without received and failed event.

2,Is there any problems in the line of eventhandler in smsd.conf I wrote above ?
3,what's the parameter of the php scripts ? I try to use $argv[1] to get it ,but it seems failed. .

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
focus wrote
1, How can I catch the exact event , for example ,i just want to catch the 'sent' event without received and failed event.

Your script should check the first argument, and if it's not "SENT", the script should exit.

focus wrote
2,Is there any problems in the line of eventhandler in smsd.conf I wrote above ?

Yes there is. The setting can contain path and filename for single executable file, not a command line.

Start your ev.php with #!/usr/local/php/bin/php line. With this definition you do not need to call interpreter, and eventhandler = /data0/apache/share/htdocs/html/ev.php should work. Note that the file ev.php must be executable for smsd.

focus wrote
3,what's the parameter of the php scripts ? I try to use $argv[1] to get it ,but it seems failed. .

Try this:

#!/usr/local/php/bin/php
<?php

if ($_SERVER['argv'][1] != "SENT")
  exit;

print_r($_SERVER['argv']);

echo "self: " .$_SERVER['argv'][0] ."\n";
echo "type: " .$_SERVER['argv'][1] ."\n";
echo "file: " .$_SERVER['argv'][2] ."\n";
echo "message_id: " .$_SERVER['argv'][3] ."\n";

?>
 
'php' Syntax Highlight powered by GeSHi


The output may be like:
Array
(
[0] => /data0/apache/share/htdocs/html/ev.php
[1] => SENT
[2] => /var/spool/sms/sent/send_123456
[3] => 123
)
self: /data0/apache/share/htdocs/html/ev.php
type: SENT
file: /var/spool/sms/sent/send_123456
message_id: 123
Member
Registered:
Aug 2010
Location: beijing, China
Topic owner
all problems settled thanks a lot.!

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.