PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old August 28th, 2002, 05:30 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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

Reply With Quote
  #2  
Old August 28th, 2002, 08:41 AM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: exec script and how to pass a parameter/varE

is there a specific reason why you can't just include() it?

Reply With Quote
  #3  
Old August 28th, 2002, 10:59 AM
Kohaar Kohaar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Denmark
Posts: 147 Kohaar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 2
Send a message via ICQ to Kohaar
RE: exec script and how to pass a parameter/varE

$execute="/home/myaccount/special/sda51.cgi?var=".$var; ?

Reply With Quote
  #4  
Old August 28th, 2002, 04:06 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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

Reply With Quote
  #5  
Old August 28th, 2002, 04:17 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
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?

Reply With Quote
  #6  
Old August 28th, 2002, 05:10 PM
Taoism Taoism is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Winnipeg, MB, Canada
Posts: 81 Taoism User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 2
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.

Reply With Quote
  #7  
Old August 28th, 2002, 06:30 PM
Kohaar Kohaar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Denmark
Posts: 147 Kohaar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 2
Send a message via ICQ to Kohaar
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

Reply With Quote
  #8  
Old August 28th, 2002, 11:59 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
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...

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > exec script and how to pass a parameter/varE


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway