I have a little problem with this pice of code. The script connects, but it wont give me the folders that are located in root ... i am missing something?
$ftp_server = "ftp.something.com";
$ftp_user = "user";
$ftp_pass = "pass";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass))
{
echo "Connected as $ftp_user@$ftp_server\n";
}
else
{
echo "Couldn't connect as $ftp_user@$ftp_server\n";
}
$contents = ftp_nlist($conn_id, ".");
var_dump($contents);
ftp_close($conn_id);
die;
It outputs
Connected as $ftp_user@$ftp_server;
and
boolean false
Why it won't list the files?
i could solve this very fast with
file_exists("ftp//user:pass@host.com")
... but the easy part is not what im looking for, i would not learn anything