Skip to content

Instantly share code, notes, and snippets.

@felixkiss
Created February 28, 2014 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixkiss/9271755 to your computer and use it in GitHub Desktop.
Save felixkiss/9271755 to your computer and use it in GitHub Desktop.
echo "sterreich"
echo "sterreich""
php test.php
Last login: Fri Feb 28 15:11:46 2014 from localhost
mbp-felix:~ foo$ echo "This is a test"
This is a test
mbp-felix:~ foo$
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Österreich äöüß
echo "Österreich"
Last login: Fri Feb 28 15:12:31 2014 from localhost
mbp-felix:~ foo$ echo "sterreich"
sterreich
mbp-felix:~ foo$ %
<?php
require 'vendor/autoload.php';
$ssh = new Net_SSH2('127.0.0.1');
$ssh->setTimeout(10);
if (!$ssh->login('foo', 'foo'))
{
throw new Exception('Could not login to SSH server.');
}
echo $ssh->read('mbp-felix:~ foo$ ');
$ssh->write('echo "This is a test"' . "\n");
echo $ssh->read('mbp-felix:~ foo$ ');
echo "\n\n";
echo $ssh->exec('locale');
echo $ssh->exec('echo "Österreich äöüß"');
echo "\n\n";
$ssh->write('echo "Österreich"' . "\n");
echo $ssh->read('mbp-felix:~ foo$ ');
$ssh->write('echo "äöüß"' . "\n");
echo $ssh->read('mbp-felix:~ foo$ ');
$ssh->disconnect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment