是否可以使用cURL通过SSH抓取文件?

编程入门 行业动态 更新时间:2024-10-26 16:27:50
本文介绍了是否可以使用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抓取文件?

本文发布于:2023-10-07 12:41:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469410.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   文件   cURL   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!