Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: ssh2_scp_recv - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ssh2_scp_send" width="11" height="7"/> <ssh2_publickey_remove
Last updated: Mon, 05 Feb 2007

view this page in

ssh2_scp_recv

(PECL)

ssh2_scp_recv — SCP 経由でファイルを要求する

説明

bool ssh2_scp_recv ( resource session, string remote_file, string local_file )

リモートサーバからローカルファイルシステムに SCP プロトコルを使用してコピーします。

例 2208. SCP 経由でファイルをダウンロードする

<?php
$connection
= ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

ssh2_scp_recv($connection, '/remote/filename', '/local/filename');
?>

ssh2_scp_send(), copy() も参照ください。



add a note add a note User Contributed Notes
ssh2_scp_recv
jcalcote at novell dot com
09-Aug-2006 05:51
If you scan a remote directory for a list of files by using opendir and readdir on a path obtained from ssh2_sftp(), you'll end up with a list of full file paths containing the ssh2.sftp://$sftp prefix, where $sftp is the sftp resource string returned by ssh2_sftp.

If you later attempt to use ssh2_scp_recv() (even on the same connection!) to copy files locally from the remote path, the copy operation will fail because ssh2_scp_recv() doesn't like the wrapper path prefix. It expects remote file references to be rooted at the base of the remote file system (eg., '/').

Moral: ssh2_scp_recv() likes paths rooted at the file system root on the remote machine, not full network paths. This routine will fail with an obscure message about not being able to copy the files - yet when you go look it works fine. Worse, when you connect and copy them from an scp shell session, it also works fine.

 
show source | credits | sitemap | contact | advertising | mirror sites