facubeta Posted February 6, 2008 Share Posted February 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
awpti Posted February 6, 2008 Share Posted February 6, 2008 So, can your server actually get reverse DNS on XXX.com.ar? Have you tried via the IP Address? Quote Link to comment Share on other sites More sharing options...
facubeta Posted February 6, 2008 Author Share Posted February 6, 2008 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? Quote Link to comment Share on other sites More sharing options...
facubeta Posted February 6, 2008 Author Share Posted February 6, 2008 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 ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.