Cyrus Kafai Wu
Cyrus Kafai Wu

Reputation: 149

Connecting to FTP via ftp:// with a username containing an @

I learned that you can use an url for things like filesize(),filetype(),isdir() and etc.

This url is: ftp://user:[email protected]/pub/fichier.txt

But, I am wondering what if your username is lets say [email protected]

Would i write the url like this:

ftp://[email protected]:[email protected]/pub/ficher.txt

Also, CPanel on shared hosting does not appear to give the option to connect without an @ symbol.

In other words, how do I login via ftp://user:[email protected] when the username is [email protected].

Thanks Cyrus

Upvotes: 1

Views: 544

Answers (1)

Mike B
Mike B

Reputation: 32145

From http://www.ietf.org/rfc/rfc1738.txt

The user name (and password), if present, are followed by a commercial at-sign "@". Within the user and password field, any ":", "@", or "/" must be encoded.

Use rawurlencode() - see Example #1

Upvotes: 2

Related Questions