简体   繁体   中英

Downloading and saving file by using wget in shell_exec

I want to download files from commandline when I run the command in shell it will work but when I want to execute it in PHP,No result

$cmd='wget http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules'
$output=shell_exec($cmd);
echo "<pre>$output</pre>";

I just wanted to download from this site

any help would be appreciated

how can i correct this?

if the solution is Curl how can I write it

Use cURL . Like this .

file_get_contents( 'http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules' );

does the same thing

By default wget write document to file

For prevent default use option: wget -q -O /dev/stdin google.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM