I have a fairly simple script running on a web server that connects via ftp to a remote ftp server and downloads a handful of small files. Its been working for over a year without any problems.
Recently it stopped, I asked the hosting company to look into it for me and they replied:
I have no idea how to do this, I'm using ftp_connect which allows a port, but if I enter 80 then surely this is the port of the remote server and not the local web server's outbound port?You will need to reconfigure your script to run over port 80 rather than over port 21 as our servers are no longer
allowing connections over that port.
I've copied a stripped down version of the script I'm using to the end of this message.
Is this possible and if so what would I need to look at to solve this issue?
Regards Alan
Code: Select all
<?php
echo 'Testing FTP connection...<br />';
// host details
$host = 'ftp.remoteserver.com';
$user = 'myusername';
$password = 'mypassword';
// connect to host
$conn = ftp_connect("$host");
if (!$conn)
{
echo 'Error: Could not connect to ftp server<br />';
exit;
}
echo "Connected to $host.<br />";
// log in to host
@ $result = ftp_login($conn, $user, $password);
if (!$result)
{
echo "Error: Could not log on as $user<br />";
ftp_quit($conn);
exit;
}
echo "Logged in as $user<br />";
// close connection to host
ftp_quit($conn);
?>