View Full Version : ftp_connect
dophinsluv
02-15-2009, 09:59 AM
I'm having problems with ftp_connect. Should I expect any issues?
This code always dies.
define("REMOTE_FTP_SERVER", "ftp.freshrpms.net"); // domain name or IP address
$remote_connection_id = ftp_connect(REMOTE_FTP_SERVER) or die("Couldn't connect to ".REMOTE_FTP_SERVER);
I've tried "ftp.heanet.ie" with the same results. I have no problem accessing these sites from Windows Explorer.
Early Out
02-15-2009, 10:06 AM
I believe you need to have a dedicated IP address to make a remote FTP connection.
dophinsluv
02-15-2009, 10:28 AM
I should clarify that I'm running this code from my Bluehost server. I have no problem accessing these ftp sites from my laptop using Windows Explorer so I don't think a dedicated IP address should be necessary to make an ftp connection.
Early Out
02-15-2009, 10:37 AM
Yes, I know you're running the code from a BH server. And I believe you need to have a dedicated IP address to make it work. But don't take my word for it - contact BH support via Live Chat, and ask.
dophinsluv
02-15-2009, 11:23 AM
Yes, I know you're running the code from a BH server. And I believe you need to have a dedicated IP address to make it work. But don't take my word for it - contact BH support via Live Chat, and ask.
Here's the response from BH support:
Our servers do block outbound connections by default except on ports 80 and 443, if you need to make connections on other ports you will need to purchace a dedicated IP address.
The cost for a dedicated IP is...
What are ports 80 and 443? How do they differ from port 21 the default ftp_connect port?
Thanks
felgall
02-15-2009, 01:29 PM
Here's the response from BH support:
What are ports 80 and 443? How do they differ from port 21 the default ftp_connect port?
Thanks
Port 80 is HTTP://
Port 443 is HTTPS://
Different prots are used for different protocols and require a server running on the other end that checks the given port for communications. Usually there would be a web server at the other end listening for communications on ports 80 and 443.
FTP requires two ports - one for the FTP commands thenselves (default 20) and the other for the file transfers (default 21). To be able to set up FTP to use ports 80 and 443 for that instead you would need to change the web server on the site to use different ports first so as to free them up for the FTP server to use instead. Then since you'd be using non-standard ports for everything nothing except what you set up would be communicating via the right ports for the server they are intended for to receive them.
hhh819
02-22-2009, 11:05 PM
There are a few ways to connect by FTP to a host. The easiest way is using Internet Explorer which has the best ftp support.
In order to connect by FTP with your browser, you should just use the following address:
ftp://YourFtpUser:YourFtpUserPassword@yourdomain.com
However, if your FTP user to connect is similar to user@yourdomain.com then you will have to URL encode it like this:
ftp://YourFtpUser%40YourDomain.com:YourFtpUserPassword@y ourdomain.com
In the above case it is important to note what the FTP username is:
YourFtpUser%40YourDomain.com
Early Out
02-23-2009, 05:23 AM
There are a few ways to connect by FTP to a host.
Please re-read the thread - this isn't about how to connect from a client to a host. The question is about how to connect from a server-side script on BH to an external FTP site. Very different.
Zhurrie
03-03-2009, 06:12 PM
There are a few ways to connect by FTP to a host. The easiest way is using Internet Explorer which has the best ftp support.
In order to connect by FTP with your browser, you should just use the following address:
ftp://YourFtpUser:YourFtpUserPassword@yourdomain.com
However, if your FTP user to connect is similar to user@yourdomain.com then you will have to URL encode it like this:
ftp://YourFtpUser%40YourDomain.com:YourFtpUserPassword@y ourdomain.com
In the above case it is important to note what the FTP username is:
YourFtpUser%40YourDomain.com
I know I am Hijacking so I apologize :D, but this thread does seem to know the most about FTP issues:
Hopefully this is a simple question but it has been kicking my butt:
How do I connect via a link to a file in my FTP if I have a public files? I want to be able to allow the world to download a Zipped file from my FTP using a link in my forums? I can get it to work with FF but not IE or vice versa , and even then I get complaints that people cannot DL properly.
Thanks
Early Out
03-03-2009, 06:44 PM
If you just want people to be able to download a file, why bother with FTP at all? Why not just move the file to public_html and put a link to the zip file on your web page?
<a href="thefile.zip">Click here to download the zip file</a>
Clicking on that link, a visitor's browser will ask him whether he wants to open it or save it.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.