Page 1 of 1

Getting a Directory Listing from a remote server

Posted: Sat May 31, 2003 7:52 pm
by Forlorn
Suppose I want to connect to a different server and get a directory listing from one of the folders.. How would I do this? (I want to connect to a server via ssh for which you will need a username and password)

Code: Select all

<?php



    $fp = fsockopen("udp://0.0.0.0", 22, &$errno, &$errstr, 5);
    if($fp)
	{
	echo connected;
	$test = exec(ls -al);
	echo "$test";
	}
	else{
	die ( "Couldn't connect to 0.0.0.0:\nError: $errno\nDesc: $errdesc\n" );
	}
	
?>
I just want to know how I can tell the server what the username and password is...