By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

Calling (non-php) scripts from inside PHP

P: n/a
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;

Dec 12 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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 <an*******@freemail.ru>

Dec 12 '07 #2

P: n/a
NC
On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotmail.comwrote:
>
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
Dec 13 '07 #3

P: n/a
On Dec 12, 7:22 pm, NC <n...@iname.comwrote:
On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotmail.comwrote:


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.
Dec 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.