On Fri, Oct 2, 2009 at 1:24 AM, goooogi goooogi <gop...@gmail.com> wrote:

>
> Dear All,
>
>  I have some php scripts which I don't want to rewrite in python. How can I
> run php Scripts in python?
>
> Thanks in advance
> Googi G
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>

Although rewriting is a better option, you can use the subprocess module to
make system calls to the php interpreter


import subprocess

#simple caller, disguard output

subprocess.call("php /path/to/my/old/script.php")

# if you want output

proc = subprocess.Popen("php /path/to/my/script.php", shell=True,
stdout=subprocess.PIPE)

script_response = proc.stdout.read()



Hope that helps,

Vince
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to