Hello all,
I am just trying to see if I can connect up with my internal FTP server from
our website. The server is accessible from the outside world, as we can log
in using a client, etc. I am not really sure how to troubleshoot this, but
below is the script that I have. I "found" it on the net (and can't remember
where), and changed it a bit for my needs. It would appear that the call to
'ftp_connect' is where it fails. I tried this with both a URL as well as the
actual IP address, both error at the same place with the same error. Is
there a way to get an actual error message that is a bit more explanatory as
to what is happening?

<?php
$ftp_server = "FTP.URL";
$ftp_user = "USER";
$ftp_pass = "PASSWORD";

echo "Trying to connect with $ftp_server using $ftp_user, $ftp_pass";

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to
$ftp_server");

if ($conn_id) {
echo "Logging in as $ftp_user, $ftp_pass.";
 $login = ftp_login($conn_id, $ftp_user, $ftp_pass);

// try to login
 if ($login) {
    echo "Connected as [EMAIL PROTECTED]";
} else {
    echo "Couldn't connect as $ftp_user\n";
}

 // close the connection
ftp_close($conn_id);
} else {
echo "Could not establish connection";
}
?>

Thanks for your help,

Mike

-- 
Peace may sound simple—one beautiful word— but it requires everything we
have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician

Reply via email to