Comm. between Python and PHP

Nick Craig-Wood nick at craig-wood.com
Wed Feb 23 01:49:54 EST 2005


Peter Hansen <peter at engcorp.com> wrote:
>  Nils Emil P. Larsen wrote:
> > What is the easiest way to make my threaded Python daemon communicate
> > with a PHP-script running from Apache2 on localhost?
> 
>  "Easiest" of course depends on lots of things, and mostly on
>  specifics that you haven't told us, and your personal preference.
> 
>  Two obvious possibilities that come to mind are "write a file
>  somewhere from PHP and poll for updates from Python", and
>  "use sockets (TCP)" or "use UDP".

If the data you want to pass is structured then you might consider
XML-RPC which is a cross platform way of passing structured data
around.  XML-RPC is part of the python standard library
(SimpleXMLRPCServer and xmlrpclib) and there seem to be several
implementations for PHP

  http://www.google.co.uk/search?q=xml+rpc+php

That might be overkill for what you want though!
-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list