Getting a Directory Listing from a remote server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Forlorn
Forum Newbie
Posts: 5
Joined: Mon May 26, 2003 12:57 am

Getting a Directory Listing from a remote server

Post 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...
Post Reply