471,107 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,107 software developers and data experts.

Calling Python code from inside php

Hi
I have a python code performing some computation for me.I have a
html page which passes certain argumnets to a php page.This php page
needs to pass on the value to the Python class and get the result
back.
How do I go about this??
Cheers
Vijay
Jun 2 '08 #1
2 4647
On Wed, 23 Apr 2008 20:11:06 +0200, vijay <gv************@gmail.comwrote:
Hi
I have a python code performing some computation for me.I have a
html page which passes certain argumnets to a php page.This php page
needs to pass on the value to the Python class and get the result
back.
How do I go about this??
popen() or proc_open() seem ideal to me.
--
Rik Wasmus
Jun 2 '08 #2
NC
On Apr 23, 11:11 am, vijay <gvijaysrini...@gmail.comwrote:
>
I have a python code performing some computation for me.I have
a html page which passes certain argumnets to a php page.This
php page needs to pass on the value to the Python class and get
the result back.
How do I go about this??
There are several ways, none is perfect.

1. Wrap your Python class into a command-line Python script and
have the PHP script run it and pass it the arguments via
command line.

2. Wrap your Python class into a Web service (you will need to
install mod_python or configure your Python interpreter to
work as a CGI program) and have the PHP script and pass it
the arguments via POST.

3. Extend .Net to support PHP (with Phalanger) and Python (with
IronPython) and see if you can get the two to work together
within .Net.

4. Extend .Net to support Python, compile your class into a DLL
and then wrap that DLL into a PHP extension.

Cheers,
NC
Jun 2 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by dmbkiwi | last post: by
3 posts views Thread by Bill Orcutt | last post: by
reply views Thread by Natsu Mizutani | last post: by
1 post views Thread by delrocco | last post: by
2 posts views Thread by Andrea Gavana | last post: by
3 posts views Thread by David Bear | last post: by
3 posts views Thread by andy.leszczynski | last post: by
varuns
reply views Thread by varuns | last post: by
3 posts views Thread by Anthony Smith | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.