phpseclib: An Introduction

phpseclib is designed to be ultra-compatible. It works on PHP4+ (PHP4, assuming the use ofPHP_Compat) and doesn’t require any extensions. For purposes of speed, mcrypt is used if it’s available as is gmp or bcmath (in that order), but they are not required.

example:

 

<?php
//important:- set include path
 set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib'); 
include('Net/SSH2.php'); 
$ssh = new Net_SSH2('www.domain.tld'); 
if (!$ssh->login('username', 'password')) 
{ exit('Login Failed'); } 
echo $ssh->exec('pwd'); 
echo $ssh->exec('ls -la'); ?>

 

reference:

http://stackoverflow.com/questions/14050231/php-function-ssh2-connect-is-not-working

http://phpseclib.sourceforge.net/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s