Re: Comm. between Python and PHP
Hello Python is perfectly capable of generating HTML. You don't have to demean yourself by working in PHP. Thanks for the tip about using Python instead of PHP to generate web pages. I may follow it. Nils Emil -- My reply-address is valid. www.bios-flash.dk Min svar-adresse er gyldig. Redning af døde BIOS'er -- http://mail.python.org/mailman/listinfo/python-list
Re: Comm. between Python and PHP
Hello Sorry for not being too exact in my request! 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 XML-RPC looks like something very suitable for my needs. It seems Python handles the remote procedure calls very easily (almost like local functions). It also works quite well in PHP. I didn't recompile anything but downloaded Keith Devens XML-RPC Library (500 lines code). With this I can call RPC-functions almost as easily as with Python. It took me just about an hour to get it working... Thanks everybody! Nils Emil P. Larsen -- My reply-address is valid. www.bios-flash.dk Min svar-adresse er gyldig. Redning af døde BIOS'er -- http://mail.python.org/mailman/listinfo/python-list
Comm. between Python and PHP
Hello I'm building a daemon in Python. It will measure and control some physical devices on a serial bus. Since it is a daemon, it will never terminate and I can't interfere with the regulation of the devices by using command line parameters. I want to control the regulation by using a Internet browser. What is the easiest way to make my threaded Python daemon communicate with a PHP-script running from Apache2 on localhost? Thank you so far! Nils Emil P. Larsen -- My reply-address is valid. www.bios-flash.dk Min svar-adresse er gyldig. Redning af døde BIOS'er -- http://mail.python.org/mailman/listinfo/python-list
Re: Comm. between Python and PHP
Nils Emil P. Larsen wrote: I'm building a daemon in Python. It will measure and control some physical devices on a serial bus. Since it is a daemon, it will never terminate and I can't interfere with the regulation of the devices by using command line parameters. I want to control the regulation by using a Internet browser. 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. Maybe if you can describe more about what you need (e.g. what form will this control take?) some even simpler suggestions will come to mind. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Comm. between Python and PHP
It wasn't quite clear, but I assume that you want a PHP script that can call on the Python daemon and not have the daemon make calls to a PHP script. You could use xml-rpc which is built into Python as of version 2.2: http://docs.python.org/lib/module-xmlrpclib.html On the PHP side xmlrpc is still experimental. You have to enable this when you build PHP: http://us3.php.net/manual/en/ref.xmlrpc.php You could also just add a simple HTTP interface to your daemon. It's pretty easy to add an HTTP interface to your daemon. Look at SimpleHTTPServer the docs: http://docs.python.org/lib/module-SimpleHTTPServer.html You will also need to read the source for SimpleHTTPServer.py to figure out how it works (I don't know why they don't just put the example in the docs instead of putting the example in the source). Yours, Noah -- http://mail.python.org/mailman/listinfo/python-list
Re: Comm. between Python and PHP
Peter Hansen [EMAIL PROTECTED] 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 [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Comm. between Python and PHP
Nils Emil P. Larsen [EMAIL PROTECTED] wrote: Hello I'm building a daemon in Python. It will measure and control some physical devices on a serial bus. Since it is a daemon, it will never terminate and I can't interfere with the regulation of the devices by using command line parameters. I want to control the regulation by using a Internet browser. What is the easiest way to make my threaded Python daemon communicate with a PHP-script running from Apache2 on localhost? Python is perfectly capable of generating HTML. You don't have to demean yourself by working in PHP. Sockets and pipe files are common methods of communicating with a daemon. -- - Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list