Web Analytics Made Easy -
StatCounter Trying to get the actual error message from ftp failed connection - CodingForum

Announcement

Collapse
No announcement yet.

Trying to get the actual error message from ftp failed connection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to get the actual error message from ftp failed connection

    Hi,

    I did finally get ftp working on filezilla, the issue was two parts, i did not have the proftp config proper, i guess its a bit fussy, and i was missing a dns A record. So the instructions didnt work as ftp.domain.com, its when i used the shared ip and it worked that i figured out i had a missing A record.

    Now i need to get my ftp working on the website itself inside the php file. I need to get the actual error message rather than just true or false from the attempted connection. No it is not working with same login data as filezilla.

    On a different note when i was working on getting my SMTP to work i managed to get it to display the error message and thats how i found out the certificate did not match, once i fixed that i got it to work.. So i thought i would try to get the error message with ftp as well.

    I am using proftp and here is my test code. Any idea what i can add to this to actually see why its not connecting? I need more than true false or cannot connect to server.

    PHP Code:

    set_time_limit
    (60);//for setting 
    $ftp_server='host.site.com';
    $ftp_server_port='21';
    $ftp_user_name='[email protected]';
    $ftp_user_pass="12345";

    // set up a connection to ftp server
    $conn_id ftp_connect($ftp_server$ftp_server_port);

    // login with username and password
    $login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);


    // check connection and login result
      
    if ((!$conn_id) || (!$login_result)) 
      { 
        echo 
    "Fail<br />";
        echo 
    "<br />";
        
    var_dump($conn_id);  //which gives me  resource(2) of type (FTP Buffer) 

      
    }else{
             echo 
    "Success<br />";
     
            }

    // close the FTP connection
    ftp_close($conn_id); 
    Thanks
    Last edited by durangod; Oct 1, 2016, 01:51 PM.
    I am not crazy, my computer had me checked but its on dialup and im still waiting for results :)
    A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
    durangod is short for durango dave

  • #2
    I found the problem, the problem was that my pw started with a $, once i moved the $ to the end of the pw, it connected. Ahhh, it should have been stored as 'password' by the software not "password" as single quoted items are taken as is...

    I will file a bug report and have them change that to single quotes.
    Last edited by durangod; Oct 1, 2016, 03:27 PM.
    I am not crazy, my computer had me checked but its on dialup and im still waiting for results :)
    A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
    durangod is short for durango dave

    Comment

    Working...
    X