mstation Posted October 12, 2009 Share Posted October 12, 2009 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? Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/ Share on other sites More sharing options...
lemmin Posted October 12, 2009 Share Posted October 12, 2009 Does it fail at connection or at logging in? Try the username without the domain in it. Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-935655 Share on other sites More sharing options...
mstation Posted October 12, 2009 Author Share Posted October 12, 2009 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 Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-935663 Share on other sites More sharing options...
lemmin Posted October 12, 2009 Share Posted October 12, 2009 I bet it is using an SSL connection. Take a look at this function: http://uk3.php.net/manual/en/function.ftp-ssl-connect.php Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-935679 Share on other sites More sharing options...
mstation Posted October 12, 2009 Author Share Posted October 12, 2009 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); ?> Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-935687 Share on other sites More sharing options...
mstation Posted October 12, 2009 Author Share Posted October 12, 2009 it says: Fatal error: Call to undefined function ftp_ssl_connect() in /home/lux666/public_html/datasheet/test.php on line 7 guess the ssl isnt setted in the php, what do you think? Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-935715 Share on other sites More sharing options...
mstation Posted October 13, 2009 Author Share Posted October 13, 2009 problem solved.. in this strange case i had to set the ftp_server to localhost.. Link to comment https://forums.phpfreaks.com/topic/177455-solved-php-ftp-connect-doesnt-work-with-correct-login/#findComment-936127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.