ftp over port 80

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alegg
Forum Newbie
Posts: 1
Joined: Thu Oct 04, 2007 11:30 am

ftp over port 80

Post by alegg »

Hi,

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:
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 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?

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);
?>
Last edited by alegg on Thu Oct 04, 2007 12:10 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why would it be the local server's outbound port?
Post Reply