[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1906
  • Last Modified:

use PHP to call out windows function (dir, ls, wget ,etc )

HI,
I'm on the verge of writing a php script that will download files from several websites to my server using PHP.
Since this is my own server therefore I enabled shell exec for PHP installation, (windows server 2003 platorm, I installed several GNU tools for windows as well) . I attached the code below.

when I executed that script via the browser, I received

TESTING EXEC FUNCTION
Array

and I don't see any downloaded file in the folder (I assume the file will be downloaded to the same folder with the script)

Can you please give me any insight?
THanks so much



<?php
echo "TESTING EXEC FUNCTION<br>";
exec ('wget http://domain.com/shapefile_shp_zip', $command_output);
echo  $command_output;
?>

Open in new window

0
valleytech
Asked:
valleytech
  • 2
  • 2
1 Solution
 
LordWolfyCommented:
instead of echo $command_output try this:

foreach ($command_output as $command_output_element)
{
  echo "$command_output_element\n";
}
0
 
valleytechAuthor Commented:
Thanks millions.
I had tried that before posting this question with "ls -la". It worked just fine.
but for "wget" (utility to download file from URL), it just showed nothing.

Thanks again!
0
 
LordWolfyCommented:

If that solves your problem can you please close the question by accepting the answer
0
 
valleytechAuthor Commented:
right! sorry ^^ ..iwas busy with other stuffs
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now