Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
titledir.php
<?php // programmed by Chun Kang


$s = ssh2_connection( '192.168.10.8', 22);


if (ssh2_auth_password( $s, 'your_id', 'your_password')) {
	echo "Authentication successful!\n";
} else {
	die( "Authentication failed...\n");
}

// get file information on the working directory in the Microsoft Windows machine
$stream=ssh2_exec( $s, "dir");
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents( $stream_out);

?>

...