FTP with special characters in the password

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kidder
Forum Newbie
Posts: 1
Joined: Tue Mar 31, 2009 2:38 pm

FTP with special characters in the password

Post by kidder »

Hi Everyone,

I am having a heck of a time trying to figure out how to get my php script to log into a standard ftp server. When I log into the ftp server from the command prompts - no problems at all (I know the username and password I fine). But as soon as I try from a php script -> it dies saying wrong password. The issue I believe is that there are special characters in the password -> a * ie. asterisks.

Here is what I have:
$fpt_server = 'ftp.servername.com';
// open a connection to the ftp server;
$conn_id = ftp_connect($ftp_server) or die ("Could not connect to $ftp_server");

// Open a session to an external ftp site
$login_result = ftp_login($conn_id, 'myusername','ABC*xyz123');

Do I have to escape that "*" or does anyone else have any other ideas. I have tried urlencode, I have tried ways to escape it with no luck.

Thoughts? Ideas? Suggestions?

This should be a super simple thing ... but has turned out to be a royal pain the butt.

Thanks in Advance,
Kid
Post Reply