This is a discussion on Calling (non-php) scripts from inside PHP within the PHP Language forums, part of the PHP Programming Forums category; In my php page I am calling a Python cgi. The problem is that originally the Python script was being ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
In my php page I am calling a Python cgi. The problem is that
originally the Python script was being called directly and it could access the environment variables that were being set. Now since the php script is being called first it has access to the environment variables, but the Python script does nt. How can I forward the variables or call the Python script in such a way where it can access those variables? These are the type of environment variables I am talking about $_SERVER['HTTP_OBREQUESTEDURL'] In my php script (which is a web page) I was calling the Python cgi like this. $output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1"); //system call print $output; |
|
|||
|
Greetings, Anthony Smith.
In reply to Your message dated Wednesday, December 12, 2007, 22:30:55, > In my php page I am calling a Python cgi. The problem is that > originally the Python script was being called directly and it could > access the environment variables that were being set. Now since the > php script is being called first it has access to the environment > variables, but the Python script does nt. > How can I forward the variables or call the Python script in such a > way where it can access those variables? > These are the type of environment variables I am talking about > $_SERVER['HTTP_OBREQUESTEDURL'] > In my php script (which is a web page) I was calling the Python cgi > like this. > $output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1"); //system call > print $output; If it is really CGI script, why not call it using CGI? Direct URL-include or some dance with cURL or socket read? Aside from that, You can try use putenv() to temporarily alter the environment before starting external application. Altered environment should be passed to it, I guess. -- Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru> |
|
|||
|
On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotmail.com> wrote:
> > In my php page I am calling a Python cgi. The problem is that > originally the Python script was being called directly and it could > access the environment variables that were being set. Now since the > php script is being called first it has access to the environment > variables, but the Python script does nt. > > How can I forward the variables or call the Python script in such a > way where it can access those variables? > > These are the type of environment variables I am talking about > $_SERVER['HTTP_OBREQUESTEDURL'] > > In my php script (which is a web page) I was calling the Python cgi > like this. > $output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1"); //system call > print $output; This might work: readfile('http://localhost/cgi-bin/setaccess.cgi'); Cheers, NC |
|
|||
|
On Dec 12, 7:22 pm, NC <n...@iname.com> wrote:
> On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotmail.com> wrote: > > > > > > > In my php page I am calling a Python cgi. The problem is that > > originally the Python script was being called directly and it could > > access the environment variables that were being set. Now since the > > php script is being called first it has access to the environment > > variables, but the Python script does nt. > > > How can I forward the variables or call the Python script in such a > > way where it can access those variables? > > > These are the type of environment variables I am talking about > > $_SERVER['HTTP_OBREQUESTEDURL'] > > > In my php script (which is a web page) I was calling the Python cgi > > like this. > > $output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1"); //system call > > print $output; > > This might work: > > readfile('http://localhost/cgi-bin/setaccess.cgi'); > > Cheers, > NC I ended up doing this: header("Location: http://wsso.prod.fedex.com/VCP/cgi-bin/setaccess.cgi"); In the PHP file I can have other code, but as long as it does not have any header information, I might be fine. I basically needed the ability to set the cookie and put things into the session. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|