473,394 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Calling (non-php) scripts from inside PHP

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
3 2055
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: A. Klingenstein | last post by:
I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by...
3
by: crispy | last post by:
Hello group, I'm again having trouble putting ASP records INSIDE html link. Here's the string I put inside Access field: No room number specified (<a...
4
by: Smoke | last post by:
We had a javascript calling a Cold Fusion page (.cfm) and it was working for 2 years. Suddenly yesterday or today its decided it doesn't want to work anymore. I'm picking up somebody elses code I...
4
by: soumitra.mishra | last post by:
Hi All, I want to call (execute) some python scripts from my C# program. I know that this can be done but have not idea how. The other option that I can think of is developing python web...
3
by: Bob | last post by:
I have created some WSH scripts on my Webserver that are executed by the Windows Task Scheduler. I want to be able to execute some of these scripts using a web interface and don't want to duplicate...
2
by: satishchandra999 | last post by:
I have SP, which has a cursor iterations. Need to call another SP for every loop iteration of the cursor. The pseudo code is as follows.. Create proc1 as Begin Variable declrations... ...
1
by: dcnicholls | last post by:
This is my first post to this forum: I use ASP occasionally but don't know a lot of it, and the Windows IIS was invented by MS to torture me :) So I'm not sure if this should be herre or on the IIS...
1
by: mini3110 | last post by:
Hi, How can I call TCL scripts from a C# project? Thanks!!!
4
by: MasterVision | last post by:
Hey folks, I have .NET Solution with the combinations of VB, C/C++ and C# projects on it. I have no problem calling C/C++ function inside my VB project but I dont know how to do the same with C#...
9
by: Catherine Moroney | last post by:
I have one script (Match1) that calls a Fortran executable as a sub-process, and I want to write another script (Match4) that spawns off several instances of Match1 in parallel and then waits...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.