473,573 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_OBREQUEST EDURL']

In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_e xec("../cgi-bin/setaccess.cgi". " 2>&1"); //system call
print $output;

Dec 12 '07 #1
3 2067
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_OBREQUEST EDURL']
In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_e xec("../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*******@free mail.ru>

Dec 12 '07 #2
NC
On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotma il.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_OBREQUEST EDURL']

In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_e xec("../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.com wrote:
On Dec 12, 11:30 am, Anthony Smith <mrsmi...@hotma il.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_OBREQUEST EDURL']
In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_e xec("../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("Locatio n: 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
1423
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 importing a module in the scripts. Is there a debugger capable of this which is Free or Open Source? What I need are the following things: - runs...
3
3061
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 href='contact.asp?subject=corrections/addition for AASG.info group ID <%=(Recordset1.Fields.Item('group_id').Value)%>'>update</a>)
4
4054
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 don't know all of the rules here. All of the examples I've found really want .JS files if called with a script tag, example below. <script...
4
1926
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 services and then calling them from from C# program. I just wanted to know what is the best option and how it can be achieved. In the end all I want is to...
3
4387
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 these scripts in ASP. I know this can be done using the WScript.Shell run method but I am having no success. Below is a test application I have...
2
3377
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... declare EffectiveDate_Cursor cursor for select field1,fld2 from tab1,tab2 where tab1.effectivedate<Getdate()
1
4626
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 area, but here goes: For the local mirror on my development PC of a site I've been managing for some years, I use the built in IIS (XP pro sp2) to...
1
3406
by: mini3110 | last post by:
Hi, How can I call TCL scripts from a C# project? Thanks!!!
4
9247
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# Project. How to call C# function inside VB.NET? Any help would be highly appreciated. Thank you
9
15520
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 until they all finish running. The only way I can think of doing this is to call it as a sub-process, rather than directly. I'm able to get Match1...
0
7699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8202
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8066
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5292
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1304
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1041
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.