PHP - How to login via curl and download files?
===

Im using php, using curl Im accessing a directory on a server via http using httpauth. I pass it a username and password and it seems to work, but once I login how do I get the current directory and then proceed to download the files in that directory? Im using this curl code to authenticate:

    	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
	curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	$output = curl_exec($ch);
	$info = curl_getinfo($ch);
	curl_close($ch);