[英]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当我在 shell 中运行命令时,我想从命令行下载文件,但当我想在 PHP 中执行它时,没有结果
$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如果解决方案是 Curl 我该怎么写
file_get_contents( 'http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules' );
file_get_contents('http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules');
does the same thing做同样的事情
By default wget write document to file默认情况下 wget 将文档写入文件
For prevent default use option: wget -q -O /dev/stdin google.com
为了防止默认使用选项:
wget -q -O /dev/stdin google.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.