我已经研究了PHP的SSH2模块,但是它需要在服务器上进行PHP重新编译,这是非常。肿。这远比我们现在想要承担的风险更大。
I've looked into the SSH2 module for PHP, but it would require a PHP recompile on a server which is very bloated. It's far more of a risk than we'd like to take on right now.
我可以使用cURL通过SSH抓取几个文件吗?我已经做了一些Google搜索,发现了一些来源,但没有100%明确是否这是可能的。
Is it possible for me to use cURL to grab a few files over SSH? I've done some Googling and found a few sources but nothing 100% clear on whether this is possible.
推荐答案不确定cURL,但如果你不想重新编译,但服务器已经安装了ssh客户端,你可以进行系统调用 scp 。
I'm not certain about cURL, but if you don't want to recompile but the server has ssh clients installed already, you can make a system call to scp. It will work best, of course, if you have SSH keys in place between the local and remote hosts.
shell_exec("/usr/bin/scp -i private_key_identity user@host:/path/to/remote/file /local/path");更多推荐
是否可以使用cURL通过SSH抓取文件?
发布评论