RE: Re: exec() Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Per Jessen [mailto:per@xxxxxxxxxxxx]
> Sent: Wednesday, June 25, 2008 2:48 PM
> To: php-general@xxxxxxxxxxxxx
> Subject: Re:  exec() Error
> 
> Wei, Alice J. wrote:
> 
> >         I have got a task from my client asking me to build something
> >         that allows the variables in the PHP file passed to another
> >         PHP file or a file in a different computer language to
> perform
> >         some operations on another remote machine. According to my
> >         client, he calls this behind the scenes to avoid users screw
> >         up the front end, and I am hoping that I can produce one
> >         single script, and have it execute some script without the
> >         user pushing any button. Has anyone tried using exec()
> >         successfully in PHP to execute files from PHP or other
> >         programming languages? For example, C, Python, or Perl.
> 
> Yeah, that's no big deal.  That's what exec() does.
> 
> >     I have tried this by putting in
> >
> >     exec("http://www.mysite.com/calculate.php";);
> 
> Well, "http://www.mysite.com/calculate.php"; is not an executable.  Try
> this instead:
> 
> exec("php <path>/calculate.php");

I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make.

Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your "result code." It's basically doing what cURL does, but outside of the PHP script itself.

Anyway, I digress. My point is that exec("php http://mysite.com/script.php";) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE.

HTH,


Todd Boyd
Web Programmer





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux