Discuss Can't use ftp_coonect to connect and copy in the PHP Development forum on Dev Shed. Can't use ftp_coonect to connect and copy 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.
Posts: 9,801
Time spent in forums: 2 Months 3 Weeks 16 h 59 m 20 sec
Reputation Power: 6112
Code:
php > $c = ftp_connect('ftp.flatmates.com') or die("Can't connect") ;
PHP Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in php shell code on line 1
"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
Posts: 1,597
Time spent in forums: 2 Weeks 4 Days 21 h 17 m 49 sec
Reputation Power: 70
Quote:
Originally Posted by ManiacDan
Code:
php > $c = ftp_connect('ftp.flatmates.com') or die("Can't connect") ;
PHP Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in php shell code on line 1
Hello Dan;
Would you please tell me why I don't get the warning you get?
Would it make a difference if I run the code from terminal?
@ptr2: Hey buddy my English is not the best. I assume you are being sarcastic aren't you? Are you asking for the credentials to my server? What is the point of your comment?
Posts: 2,476
Time spent in forums: 1 Month 2 Weeks 2 Days 5 h 34 m 52 sec
Reputation Power: 2194
No, you POSTED your credentials in your original post. requinix was kind enough to remove them before some random dude used them. Probably should still change them, in case someone grabbed them.
__________________
I ♥ ManiacDan & requinix
This is a sig, and not necessarily a comment on the OP: Please don't be a help vampire!
Posts: 12,690
Time spent in forums: 5 Months 1 Week 4 Days 3 h 43 m 47 sec
Reputation Power: 8969
Quote:
Originally Posted by zxcvbnm
Hello Dan;
Would you please tell me why I don't get the warning you get?
Would it make a difference if I run the code from terminal?
Is there anything else to the script? You only posted a few lines from it - I don't see any <?php or ?> tags. Could be there's a syntax error (or some other error) stopping execution.
Also, add an echo after the ftp_close() and look for that message.
Regarding the username and password, I removed them 16 hours after you posted. That's more than enough time for search engines to come here, grab the content, cache it, and serve it to anybody who uses the right search terms. Like ptr2void said you should definitely change them; at least the password, and not just for the FTP account but anywhere else you may use them too.
Posts: 1,597
Time spent in forums: 2 Weeks 4 Days 21 h 17 m 49 sec
Reputation Power: 70
Hello gang;
A few things:
1 - I never put the correct server details in the forum. I always change them, same with the server location, domain name and others. But thank you for your concern and looking after me.
2 - I use the code below and I get no errors, I actually get the Copied message now but I can't see the file copied there in the folder. The folder exists and it is 777. Can anyone see what is wrong? Thank you
Posts: 1,597
Time spent in forums: 2 Weeks 4 Days 21 h 17 m 49 sec
Reputation Power: 70
Quote:
Originally Posted by zxcvbnm
- I use the code below and I get no errors, I actually get the Copied message now but I can't see the file copied there in the folder. The folder exists and it is 777. Can anyone see what is wrong? Thank you