Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

triggering events from PHP script

If you have a question or need help, this is the place to be.
Post Reply
manjh
Posts: 41
Joined: Thu Mar 12, 2009 11:14 am

triggering events from PHP script

Post by manjh »

I am looking for the best way to trigger events from within a PHP script, on an existing server running on the same machine as my EventGhost instance. I played with the Webserver plugin, but I don't want my entire existing server in that setup.
So I am looking for a way, from within existing server setup, do a program-to-program call to EventGhost.
Can someone point me at the way to do this, and which plugin to use?
User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: triggering events from PHP script

Post by jinxdone »

- Load the webserver plugin and make a php client that uses http request to trigger events in EG.
- Load the network event receiver plugin and make a php client that uses a tcp socket to trigger events in EG.
- You can run "EventGhost.exe -e event" command (check command line syntax from http://www.eventghost.org/wiki/Command-line_reference)


These are the best ways that I can think of right now. Obiviously the first two will allow you to connect to other machines running EG as well as they work over the network.
jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: triggering events from PHP script

Post by jsonnabend »

As a variation of jinxdone's third option, you can use the -n command line switch to trigger events, even over a network. See the wiki entry.

- Jeff
User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: triggering events from PHP script

Post by jinxdone »

Ah yep, indeed, I missed that one.

I think php is mostly run on apache running on linux so probably coding a bit of php (options 1 and 2) that wont be dependant of the eventghost.exe is the best option. If you do make a nice php function to trigger events in EG though the network sender for example please do post it here on the forum/coding corner. ;)
manjh
Posts: 41
Joined: Thu Mar 12, 2009 11:14 am

Re: triggering events from PHP script

Post by manjh »

jinxdone wrote:Ah yep, indeed, I missed that one.

I think php is mostly run on apache running on linux so probably coding a bit of php (options 1 and 2) that wont be dependant of the eventghost.exe is the best option. If you do make a nice php function to trigger events in EG though the network sender for example please do post it here on the forum/coding corner. ;)
I run EasyPHP, an Apache implementation, under Windows XP.
Calling EG via the commandline option would work I suppose, although performance worries me somewhat. But I'll give it a try.
The other options sound more technically appropriate, but also a lot more work. I'll see if I can find some time to work it out... when I do, will let you know!
Post Reply