<?php
// --- SIMPLE BROWSER-RUNNABLE SFTP TEST ---
$host = '108.61.85.3';
$port = 22;
$username = 'newadmin';
$password = 'devbrewing21';
echo "<pre>Connecting to $host:$port...\n";
$conn = @ssh2_connect($host, $port);
if (!$conn) {
die("ā Could not connect to $host:$port\n</pre>");
}
if (!@ssh2_auth_password($conn, $username, $password)) {
die("ā Authentication failed for user $username\n</pre>");
}
echo "ā
Connected and authenticated successfully!\n";
$sftp = @ssh2_sftp($conn);
if (!$sftp) {
die("ā Failed to start SFTP subsystem\n</pre>");
}
echo "ā
SFTP subsystem started!\n\n";
// List remote home directory
$handle = @opendir("ssh2.sftp://$sftp/.");
if (!$handle) {
die("ā Could not open remote directory\n</pre>");
}
echo "š Remote directory listing:\n";
while (false !== ($file = readdir($handle))) {
echo " - $file\n";
}
closedir($handle);
echo "\nā
Done!</pre>";
?>