Hi everybody !

I encounter a problem that bother me for 2 days now !

I manage to use the php function ftp_connect() with an host name like ftp.multimania.com (i use the connection script of the PHP manual).
But the server i want to use got an IP Address : i try with that and it doesn't work !
Can somebody explain me the reason why ?

and if i have to use an host name like ftp.blahblah.com or if i can fix it with an IP address ? Please !

Fonkyseb
(excuse my english, coz i'm a french dude!! 😉 )

    actually, i check my connection with this code :

    $conn_id = ftp_connect($ftp_server);
    login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
    if ((!$conn_id) || (!$login_result)) {
    echo "Connection FTP failed!";

    die;
    } else {
    echo "Connected to ".$ftp_server;
    }

    with $ftp_server as an IP Address, ftp_connect() return false. if i use an host name like ftp.multimania.com ,for instance,it works....

      • [deleted]

      First, change that code, because now you can't tell wether your connection failed, or wether you just could not login.

      Then make sure you are using the right IP number.

        i already checked this out ! 😉
        it is my connection that failed and it's the right IP Address and i can reach it via the browser (IE5).....
        I just don't understand why it works with an host name and it doesn't with the IP Address !

          • [deleted]

          It should work with the IP just as well as with the hostname.

          I take it you enter the IP as a string: "1.2.3.4"?

            yep !
            i enter $ftp_server="1.2.3.4";
            and then i use it in ftp_connect()
            I'm quite lost right now coz I can reach this IP Address using a software like leechFTP ,for instance, and it still does not work with ftp_connect()....
            :-(((((

              Thanx for your help Vincent !
              It seems that this function really DOES NOT WORK with the IP directly !
              I use the function
              gethostbyaddr("IP_Address");

              It transforms the IP into a domain name and it seems to work !

              🙂)))

                Write a Reply...