PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 11th, 2013, 11:59 PM
zxcvbnm's Avatar
zxcvbnm zxcvbnm is online now
A Change of Season
Click here for more information.
 
Join Date: Mar 2004
Posts: 1,597 zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 17 m 49 sec
Reputation Power: 70
Can't use ftp_coonect to connect and copy

Hello;

I see a blank page and no files gets copied anywhere! What am I doing wrong?
PHP Code:
 error_reporting(-1);
$c ftp_connect('ftp.flatmates.com') or die("Can't connect") ;
ftp_login($c,'...','...') or die('Can\'t login');
ftp_put($c,'about.php','about.php_copy'FTP_ASCII) or die('Can\'t copy');
ftp_close($c); 

Last edited by requinix : February 12th, 2013 at 04:16 PM. Reason: credentials, dood

Reply With Quote
  #2  
Old February 12th, 2013, 08:24 AM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,801 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
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
Comments on this post
ptr2void agrees: Probably a good thing, what with the apparent broadcasting of his credentials
__________________
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.

Reply With Quote
  #3  
Old February 17th, 2013, 04:06 PM
zxcvbnm's Avatar
zxcvbnm zxcvbnm is online now
A Change of Season
Click here for more information.
 
Join Date: Mar 2004
Posts: 1,597 zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
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?

Thanks guys

Reply With Quote
  #4  
Old February 17th, 2013, 04:12 PM
ptr2void ptr2void is online now
I haz teh codez!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2003
Posts: 2,476 ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level) 
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!

Reply With Quote
  #5  
Old February 17th, 2013, 04:27 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,690 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 3 h 43 m 47 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
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.

Reply With Quote
  #6  
Old February 17th, 2013, 06:33 PM
zxcvbnm's Avatar
zxcvbnm zxcvbnm is online now
A Change of Season
Click here for more information.
 
Join Date: Mar 2004
Posts: 1,597 zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
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

The code below prints:
Code:
Connected
Logged
Copied
1
PHP Code:
<?php error_reporting(-1);
$connected ftp_connect('ftp.domainname.com') or die("Can't connect") ;
if(
$connected)
    {
        echo 
"Connected<br />";    
    }
else
    {
        echo 
"Can't connect<br />";    
    }
$logged ftp_login($connected,'username','password') or die('Can\'t login');
if(
$logged)
    {
        echo 
"Logged<br />";    
    }
else
    {
        echo 
"Can't log in<br />";    
    }
$copy ftp_put($connected,'copy_here','local_file.php'FTP_ASCII) or die('Can\'t copy');
if(
$copy)
    {
        echo 
"Copied<br />";    
    }
else
    {
        echo 
"Not Copied<br />";    
    }
echo 
ftp_close($c);?>

Reply With Quote
  #7  
Old February 18th, 2013, 04:27 AM
zxcvbnm's Avatar
zxcvbnm zxcvbnm is online now
A Change of Season
Click here for more information.
 
Join Date: Mar 2004
Posts: 1,597 zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level)zxcvbnm User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
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

The code below prints:
Code:
Connected
Logged
Copied
1
PHP Code:
<?php error_reporting(-1);
$connected ftp_connect('ftp.domainname.com') or die("Can't connect") ;
if(
$connected)
    {
        echo 
"Connected<br />";    
    }
else
    {
        echo 
"Can't connect<br />";    
    }
$logged ftp_login($connected,'username','password') or die('Can\'t login');
if(
$logged)
    {
        echo 
"Logged<br />";    
    }
else
    {
        echo 
"Can't log in<br />";    
    }
$copy ftp_put($connected,'copy_here','local_file.php'FTP_ASCII) or die('Can\'t copy');
if(
$copy)
    {
        echo 
"Copied<br />";    
    }
else
    {
        echo 
"Not Copied<br />";    
    }
echo 
ftp_close($c);?>
Can anyone please answer this?

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Can't use ftp_coonect to connect and copy

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap