PDA

View Full Version : PHP Script to FTP file to another website



johnlanglois
04-14-2009, 10:44 PM
I have a client who wants to automate the sending of a a file from his Bluehost website to another website.
I have SSH setup on his site.

I am trying manually to execute the FTP inside the PHP script, but will set it up as a CRON job when it finally works.

At present, the PHP command "ftp_connect" fails to connect to the remote server via port 21.

Should I use a different port? The login, password, etc. all work because we are able to move the files from my pc to the website via FileZilla.

Thanks.

areidmtm
04-15-2009, 11:30 AM
To be able to make outbound connections, you will need to have a dedicated IP address. Contact support about this.

johnlanglois
04-16-2009, 08:50 PM
We have a dedicated IP now.

What port should I use to get out of the server?

areidmtm
04-17-2009, 08:21 AM
You should be able to use the ftp_connect function now and make the connection on port 21

johnlanglois
04-17-2009, 09:41 PM
Having the dedicated IP solved the FTP problem.

Thanks.