I know you can use PHP to call shell programs but is it possible to use php to call a custom program (say a daemon service I write in c) through tcp/ip? If this is possible what php functions can I use to do this? Are there any tutorials out there that cover this?
@shimonJun 23.2004 — #Hmm yeah you should be able to do that relatively easily - I'm not sure about tutorials but there's some examples in the manual.
If you have your daemon humming away listening on some port or other you should be able to use [URL=http://www.php.net/fsockopen]fsockopen()[/URL] to connect to it and then the various fputs(), fgets() functions to exchange data with the daemon.
You'll have to implement the actual interaction/top-level protocol yourself, of course. The nicest thing to do would be to create a PHP class that wraps it all up and provides a clean API to your main PHP code.