【发布时间】:2016-05-08 16:49:59
【问题描述】:
我正在尝试将我编写的 wget 命令集成到 php 脚本中。该命令递归地下载网站上的每个 html/php 文件(这是我在 file_get_contents() 中没有找到的必需功能)。我已经在终端窗口中测试了 wget 命令,但是当使用 exec() 或 shell_exec() 执行它时,没有任何反应。我没有收到任何错误或警告。
这是有问题的命令,
wget --recursive -m --domains oooff.com --page-requisites --html-extension --convert-links -R gif,jpg,pdf http://www.oooff.com/
我尝试过来自 exec() 和 shell_exec() 的简单 wget 命令(参数不多),但它们也不起作用。
如果 wget 不是一个选项,我愿意使用其他方法下载整个网站。
我现在拥有的代码是,
exec("wget google.com", $array);
那么当打印数组时它是空的
【问题讨论】:
-
你的php代码是什么?
-
@CharlSteynberg 功能开启,问题依旧
-
@mh-cbon 我的代码是 exec("wget google.com", $array);然后我打印数组,它是空的,没有文件出现
标签: php exec wget shell-exec