Jump to content

[SOLVED] PHP FTP connect doesn't work with correct login


mstation

Recommended Posts

Hi!

 

i am working on this test code:

<?php

                   

$ftp_server = "ftp.*******.it";

$ftp_user = "weburl@*******.it";

$ftp_pass = "CENSORED";

 

// set up a connection or die

$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

 

// try to login

if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {

    echo "Connected as $ftp_user@$ftp_server\n";

} else {

    echo "Couldn't connect as $ftp_user\n";

}

 

// close the connection

ftp_close($conn_id); 

?>

 

even though the username and password and domain are correct i still can't connect.. when i put the same details into my filezilla it connects immediately without errors.. can anyone help?

unfortunately my username is really that.. it's not the domain but the username is made of a word@domain.. i can change this settings in the panel if this makes the php act wrong..

 

and as for what you was asking i get an error on the connection and not on the login.. it looks like it cant contact the domain.. btw if i ping the domain i can see it's ip but i don't receive replys

is this what i should be doing or am i missing some important parts to this?

 

<?php

$ftp_server = "ftp.******.it";

$ftp_user = "weburl@******.it";

$ftp_pass = "***********";

 

// set up basic ssl connection

$conn_id = ftp_ssl_connect($ftp_server) or die("Couldn't connect to $ftp_server");

 

// login with username and password

$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);

 

echo ftp_pwd($conn_id); // /

 

// close the ssl connection

ftp_close($conn_id);

?>                   

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.