|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
exec script and how to pass a parameter/varE
I Want to execute another PHP script and want to pass a parameter/variable.
Tried to pass as a get this way: $var="test"; $execute="/home/myaccount/special/sda51.cgi?var=$var"; exec("/usr/bin/php $execute"); It does not execute so I tried the following which does execute but I cannot grab the var $var="test"; $execute="/home/myaccount/special/sda51.cgi"; exec("/usr/bin/php $execute $var"); Tried to the following without any results: $var1=$var['0']; $var1a=$var['1']; $var1b=$var['2']; $var1c=$var['3']; $var1d=$var['4']; $var2=$var['var']; Any Ideas ? Thanks, Peter M |
|
#2
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
is there a specific reason why you can't just include() it?
|
|
#3
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
$execute="/home/myaccount/special/sda51.cgi?var=".$var; ?
|
|
#4
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
When I use include(
The included script will not exec( the next script. As soon as I place a ? in the following, there is no execution at all. $execute="/home/myaccount/special/sda51.cgi?var=".$var; ? Can you think of any other tricks ? Many thanks, Peter |
|
#5
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
Could you maybe explain to us what the scenario is (bigger picture), maybe there is a completely different (possibly more efficient) way of skinning it?
|
|
#6
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
Instead of executing the php file directly, write a batch file with all the command line parameters...
First, drop to your command line interface and try to execute the script using php as a command line call... IF that works, then take that exact line and have your program write a batch file (i.e. myfile.bat) and then call that to execute... then delete it... Although, you should be able to directly invoke a command line execution of PHP from within a PHP script. So, I would first run it manually from the command line to ensure it is working... Cheers, Keith. |
|
#7
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
You are aware that the ? should not be included in .$var; ?
It should just be .$var; The ? was because I wasn't sure it might solve the problem |
|
#8
|
|||
|
|||
|
RE: exec script and how to pass a parameter/varE
u can use argc and argv to access command line parameters, but i think they are now in $_SERVER array.
anyway, look at http://php.net/features.commandline for more... |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > exec script and how to pass a parameter/varE |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|