The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP5 - Connecting to ftp server and getting a list
Discuss Connecting to ftp server and getting a list in the PHP Development forum on Dev Shed. Connecting to ftp server and getting a list PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

September 29th, 2012, 12:36 PM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 6
Time spent in forums: 1 h 32 m 19 sec
Reputation Power: 0
|
|
|
PHP5 - Connecting to ftp server and getting a list
Hello group.
I'm trying to connect to a ftp server and I'm not able to connect. I'm getting the Could not connect to nhc.noaa.gov.
Here's the code I'm using. Appreciate any suggestions. I've also tried using the IP address with the same result.
PHP Code:
$ftp_path="nhc.noaa.gov";
$conn = ftp_connect($ftp_path) or die("Could not connect to $ftp_path");
$ftp_user_name= "anonymous";
$ftp_user_pass= "someone@gmail.com";
$login_result = ftp_login($conn, $ftp_user_name, $ftp_user_pass);
ftp_chdir($conn, "/atcf/aid_public/");
print_r (ftp_rawlist($conn,"."));
ftp_close($conn);
Using google chrome, I can go to the url without a problem and get the file list.
Thanks for any suggestions.
Bryan
|

September 29th, 2012, 10:52 PM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
Quote: Using google chrome, I can go to the url without a problem and get the file list. | You sure about that? I can't hit that FTP site with PHP, chrome, or an FTP client.
__________________
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
|

September 30th, 2012, 09:23 AM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 6
Time spent in forums: 1 h 32 m 19 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by ManiacDan You sure about that? I can't hit that FTP site with PHP, chrome, or an FTP client. |
Yes, here's the link to the site for use in a browser. I'm not allowed to post links so I mangled it a little to show.
ftp :// ftp. nhc. noaa. gov/ atcf/ aid_public/
Regards,
Bryan
|

September 30th, 2012, 09:30 AM
|
|
|
From your original post:
Quote:
php Code:
Original
- php Code |
|
|
|
$ftp_path="nhc.noaa.gov";
|
From the link you provided:
Quote: | ftp://ftp.nhc.noaa.gov/ atcf/ aid_public/ |
Don't you see the difference?
__________________
I ♥ ManiacDan & requinix
This is a sig, and not necessarily a comment on the OP:
Please don't be a help vampire!
|

September 30th, 2012, 10:02 AM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 6
Time spent in forums: 1 h 32 m 19 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by ptr2void From your original post:
From the link you provided:
Don't you see the difference? |
Thanks for the reply. Yes, I've tried every variation of the domain name with ftp in front, not in front etc...
Right now, I cannot even get to the ftp site again with my browser, but I could 30 minutes ago. Maybe there is a DNS issue. I've even tried to ping the ftp. nhc. noaa. gov site and do not get a response, but I do get a response from nhc. noaa. gov. Same situation with filezilla. It is hit and miss on connecting.
Would it be too much to ask to copy the code on your machine and run it to see if it works? Sorry if I'm asking too much... I know people's time is important....
Thanks for any other suggestion you might have.
|

September 30th, 2012, 07:42 PM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
Quote: | Would it be too much to ask to copy the code on your machine and run it to see if it works? | That's how I discovered that the server you're trying to hit isn't responding. Note that I even said I couldn't do it in PHP.
If the site is down, FTP won't work.
Changing to ftp_connect('ftp.nhc.noaa.gov'); worked for me, again from PHP.
|

September 30th, 2012, 09:11 PM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 6
Time spent in forums: 1 h 32 m 19 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by ManiacDan That's how I discovered that the server you're trying to hit isn't responding. Note that I even said I couldn't do it in PHP.
If the site is down, FTP won't work.
Changing to ftp_connect('ftp.nhc.noaa.gov'); worked for me, again from PHP. |
Reading your response earlier, I do see you said you tried the script...
Thanks for your help. Still no luck on my end with the script and the browser is very intermittent ... Seems like IE connects occasionally, but no luck with Chrome.
Hopefully this is a weekend maintenance thing with the server and not an ongoing problem.
Thanks again,
Bryan
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|