Hi, I'm new to FTP using PHP. I need to ftp a remote server to retrieve and save a file to my local C: drive. The very first step I did is:
$ftp_server = "202.xxx.xxx.xxx"; //xxx will be replaced with remote server IP address
$conn_id = ftp_connect($ftp_server);
$ftp_user_name = "testuser";
$ftp_user_pass = "testuser";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result))
echo "FTP connection failed";
I always failed to connect to the server. Hence, I tried using my own computer IP address and username & password, but the connection failed too. What's wrong with my code?
Please enlighten me.