Jump to content

Cannot log in to FTP using ftp_login - PLS URGENT HELP NEEDED!


facubeta

Recommended Posts

I've tried everything to accomplish something AS SIMPLE AS logging in to an FTP server and I cannot get it to work from PHP.

 

server: XXX.com.ar........  username: YYY.......... password: ZZZ

 

In Filezilla I have everything configured by default (type: normal, port: 21) and it works PERFECTLY.

 

BUT in PHP I do this: $cid = ftp_connect("XXX.com.ar",21);

and I get $cid variable null. WHICH SUCKS.

 

so I tried this: $cid = ftp_connect("XXX.com",21); (notice that I took off .ar)

and I get $cid = "Resource id #2".... WHICH IS GOOD.

but then when I try $result= ftp_login($cid, "YYY","ZZZ");

I get "ftp_login(): Login incorrect".

 

I'm going NUTS. I've already tried the "gethostbyname" thing in case that was the problem.... but I just got the same.

 

HELP!!! anyone? THANK YOU!!

regards!

Facundo

 

Link to comment
Share on other sites

First of all, THANK YOU FOR TRYING TO HELP ME! :)

 

I don't know anything about the FTP server and I do not have control over it.

 

I tried ping ftp.xxx.com.ar and I got the IP address which looks like this:  200.123.nnn.103.

I tried this IP instead of hostname in Filezilla and it works perfectly.

I tried typing FTP 200.123.nnn.103 on the windows command line and it requested user and password. And it worked too!! (I was able to do DIR at least)

 

Then I tried it on my script, and ftp_connect() fails (returns blank resource id)

 

Any ideas? this is driving me nuts.

thank you!!!

Facundo

 

So, can your server actually get reverse DNS on XXX.com.ar?

 

Have you tried via the IP Address?

Link to comment
Share on other sites

I thought I might include 3 pieces of code and what I get as output..... that may help you help me :)

THANK YOU

 

 

<?

$cid = ftp_connect("ftp.xxx.com.ar",21);

echo "conn result: ".$cid."<br>";

$resultado = ftp_login($cid, "yyy","zzz");

echo "login result: ".$resultado ;

?>

 

conn result:

Warning: ftp_login() expects parameter 1 to be resource, boolean given in...

-----------------------------------

<?

$cid = ftp_connect("ftp.xxx.com",21);

echo "conn result: ".$cid."<br>";

$resultado = ftp_login($cid, "yyy","zzz");

echo "login result: ".$resultado ;

?>

 

conn result: Resource id #2

Warning: ftp_login(): Login incorrect. in ...

 

-----------------------------------

<?

$cid = ftp_connect("200.123.nnn.103",21);

echo "conn result: ".$cid."<br>";

$resultado = ftp_login($cid, "yyy","zzz");

echo "login result: ".$resultado ;

?>

conn result:

Warning: ftp_login() expects parameter 1 to be resource, boolean given in ...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.