Giulio wrote:
> HI all,
>
> I have a script that uses fopen to acces for read a file using ftp:
>
> $filepointer = fopen($address,'r');
>
> having $address string formed this way:
>
> $address =
> "ftp:/
> /".$FTPuser.":".$FTPpassword."@".$FTPserver."/".$FileFolder"."/".$FileNa
> me;

You really don't need all those '.' in there:P

$address = "ftp://$FTPuser:[EMAIL PROTECTED]/$FileFolder/$FileName";

will work just fine.

Not any faster or anything, just more readable.

> This script always worked for me, it has now stopped working trying it
> on the server of a different provider, returning an error 'failed to
> open stream...'
>
> I have the suspect that the funcion is failing due to the particular
> account name ( used also as FTP username ) this italian provider gived
> me when I sibscribed: It contains a @ symbol ( I.E., [EMAIL PROTECTED] ),
>   and I believe that this confuses the parsing of the
> ftp://User:[EMAIL PROTECTED]/filepath string.
>
> Can you confirm this, or do you believe that the problem could be
> caused by other factors ( like server settings ) ?
>
> Could you suggest me e workaround?

Try using just the 123456 of the username...  Probably won't work, but
worth a shot.

Or do this:
$FTPuserURL = urlencode($FTPuser);
before you compose the $address, and use $FTPuserURL instead of $FTPuser.

That will replace the @ with %40 which will almost for sure be the kosher
way have @ in an FTP username in a URL.

Technically, you could/should also urlencode() the password and FilePath
and FileName, I think.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to