You are here: Re: [PHP] fopen problem using ftp « PHP « IT news, forums, messages
Re: [PHP] fopen problem using ftp

Posted by Richard Lynch on 10/04/83 11:08

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:$FTPpassword@$FTPserver/$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., 123456@aruba.it ),
> and I believe that this confuses the parsing of the
> ftp://User:password@ftpserver/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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация