Re: note 63641 modified in ref.ssh2 by langemeijer
| From: | Casper Langemeijer | Date: | Sat, 10 Nov 2012 23:13:18 +0000 |
| Subject: | Re: note 63641 modified in ref.ssh2 by langemeijer | ||
| References: | 1 2 3 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191856@lists.php.net to get a copy of this message | ||
I have not escaped anything manually. My guess is that note-editing is broken. I won't make anymore changes to notes. Please let me know when note-editing gets fixed so I'll edit this same note again.
On 11/10/2012 10:07 PM, Maciek Sokolewicz wrote:
I don't think this is correct. Every single quote in the code here is escaped. The original note was more correct than the correction. Please fix it (and watch out for such mistakes in the future). - Tul On 10-11-2012 15:22, langemeijer@php.net wrote:To list directory contents: <?php $connection = ssh2_connect(\"hostname\", 22); ssh2_auth_password($connection,\"username\", \"password\"); // or use any of the ssh2_auth_* methods $sftp = ssh2_sftp($connection); $dh = opendir(\"ssh2.sftp://$sftp/path/to/dir/\"); while (($file = readdir($dh)) !== false) { echo \"$file is in hostname:/path/to/dir\\n\"; } closedir($dh); ?> (thanks to Sara for assisting) --was-- To slightly correct the directory listing code below.... <?php $connection = ssh2_connect("hostname", 22); // use any of the ssh2_auth_* methods ssh2_auth_password($connection,"username", "password"); $sftp = ssh2_sftp($connection); $dir = "ssh2.sftp://$sftp/path/to/dir/"; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { echo "$file is in hostname:/path/to/dir\ n"; } closedir($dh); ?> (thanks to Sara for assisting) http://php.net/manual/en/ref.ssh2.php