FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » php exec http url
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: php exec http url [message #185188 is a reply to message #185182] Fri, 07 March 2014 14:09 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
bishop2001 wrote:
^^^^^^^^^^
Please fix.

> I am trying to execute a shell script which is residing on a webserver on
> a remote machine with no luck. I have tried the following. It looks like
> it runs but I never see the output from the script on machine2. Any
> suggestions. Thanks,
>
> from machine 1:
> echo exec('http://machine2/script.sh);

exec() executes commands in the shell running on the local machine (where
PHP is running), assuming it is allowed (for security reasons, it usually is
not). http://machine2/script.sh is not a command in any known shell
script language.

> and
>
> from machine1:
> <?php
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, "http://machine2/script.sh");
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_exec($ch);
> curl_close($ch);
> ?>

Even if a Web server would serve that resource, it would not execute it by
default, IOW by default you would receive only the source code of the shell
script, not its output.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Experienced Web designer required
Next Topic: When a random file is not found then what?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 21:50:43 GMT 2024

Total time taken to generate the page: 0.05320 seconds