是否可以使用cURL通过SSH抓取文件? [英] Is it possible to use cURL to grab files via SSH?

查看:362
本文介绍了是否可以使用cURL通过SSH抓取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究了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抓取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆