gpt4 book ai didi

php - 从 exec() 或 shell_exec() 调用时 wget 不工作

转载 作者:搜寻专家 更新时间:2023-10-31 20:35:19 28 4
gpt4 key购买 nike

我正在尝试将我编写的 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);

然后在打印数组时它是空的

最佳答案

我必须指定 wget 的路径。新命令:

exec("/usr/local/bin/wget google.com", $array);

关于php - 从 exec() 或 shell_exec() 调用时 wget 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37102342/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com