calling php function from python

Benjamin Niemann pink at odahoda.de
Wed Feb 14 03:58:09 EST 2007


Rob Wolfe wrote:

> 
> mark wrote:
>> is it possible to call a php function from python and use a class from
>> php in python? i want to use mmslib which creates mms messages and the
>> only implementation is a php mmslib implementation.
> 
> You can consider to use some kind of RPC (remote procedure call)
> for example XML-RPC. This is a platform and language independent
> solution.
> Here you have some information:
> http://www.faqs.org/docs/Linux-HOWTO/XML-RPC-HOWTO.html
> http://groups.google.pl/group/comp.lang.python/msg/5a6ae6290593fc97

For a quickstart it's probably easier to run the PHP code using the CGI
version of the PHP interpreter. E.g.
os.system('/usr/bin/php mms.php')
or using the subprocess module, if you want to pass some data to the script
(using stdin/out).

As long as no remote PHP server is involved this is easier and perhaps even
faster than the RPC approach...

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/



More information about the Python-list mailing list