dbrb2 Posted July 3, 2012 Share Posted July 3, 2012 Hi, I have an ftp server, with a username of the form: abcd@defg and a password both alphanumeric and non-alphanumeric characters If I log into the server from the command line (linux), all is fine If I try the same credentials using ftp_login(), then I reliably vget authentication failure Does ftp_login need credentials to be escaped in some way? Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 3, 2012 Share Posted July 3, 2012 Post the code please. Quote Link to comment Share on other sites More sharing options...
dbrb2 Posted July 3, 2012 Author Share Posted July 3, 2012 $ftp_server="1.2.3.4"; $ftp_user_name="user@host.foo"; $ftp_user_pass="abc@cde*#"; $ftp_port=21; $conn_id = ftp_connect($ftp_server,$ftp_port,30) or die("Couldn't connect"); $login_result = ftp_login ($conn_id,$ftp_user_name,$ftp_user_pass); print_r($login_result); ftp_close($conn_id); I have also tried using ftp_raw - I think it may be the @ in the username causing problems. However, my attempts to escape it thus far have failed. For instance, replacing it with '%40' gives: ftp_login(): Syntax error in parameters or arguments Any ideas? Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 3, 2012 Share Posted July 3, 2012 Have you tried the username without the host attached? Quote Link to comment Share on other sites More sharing options...
dbrb2 Posted July 3, 2012 Author Share Posted July 3, 2012 No - however I have it sorted I ran wireshark up whilst trying from the command line (OK) and php (not OK) The difference was obvious - the password contained a $ sign, which was being treated as a special character by php. Esacaping it with a \ character, all is now fine! 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.