Code: Select all
<?php
// set up basic connection
$ftp_server = "ftp.atmos.washington.edu";
$conn_id = ftp_connect($ftp_server);
// check connection
if (!$conn_id) {
echo "No connection made!";
}
else {
$login_result = ftp_login($conn_id, "anonymous", "gtm");
if ((!$login_result)) {
echo "<P>FTP connection has failed!";
echo "<P>Attempted to connect to $ftp_server";
exit;
}
else
echo "<P>Connected to $ftp_server, for user $ftp_user_name";
}
ftp_close($conn_id);
?>What I can not figure out is that I can connect without any problem using ftp from a command prompt, a browser or ws_ftp. I am sure the port is 21 since I can see the port when I connect through ws_ftp. The only difference I can think of is that I am running the php code on a server at my ISP and I am using the ftp commands from my own computer.
Any suggestions?
Thanks
George