note 119630 added to function.ssh2-scp-recv
| From: | liubomyr dot pelo at gmail dot com | Date: | Wed, 20 Jul 2016 19:56:15 +0000 |
| Subject: | note 119630 added to function.ssh2-scp-recv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206062@lists.php.net to get a copy of this message | ||
In case if you get:
Warning: ssh2_scp_recv(): Unable to receive remote file in /some-php-file.php on line 2
Use
stream_get_contents function.
Example:
<?php
$stream = @fopen("ssh2.sftp://$sftp$remoteFile", 'r');
if (! $stream) {
throw new \Exception("Could not open file: $remoteFile");
}
$contents = stream_get_contents($stream);
file_put_contents ($localFile, $contents);
@fclose($stream);
?>
----
Server IP: 72.52.91.14
Probable Submitter: 31.148.255.40
----
Manual Page -- http://php.net/manual/en/function.ssh2-scp-recv.php
Edit -- https://master.php.net/note/edit/119630
Del: integrated -- https://master.php.net/note/delete/119630/integrated
Del: useless -- https://master.php.net/note/delete/119630/useless
Del: bad code -- https://master.php.net/note/delete/119630/bad+code
Del: spam -- https://master.php.net/note/delete/119630/spam
Del: non-english -- https://master.php.net/note/delete/119630/non-english
Del: in docs -- https://master.php.net/note/delete/119630/in+docs
Del: other reasons-- https://master.php.net/note/delete/119630
Reject -- https://master.php.net/note/reject/119630
Search -- https://master.php.net/manage/user-notes.php