Connecting to FTP via ftp:// with a username conta

2019-08-05 10:45发布

问题:

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

This url is: ftp://user:password@example.com/pub/fichier.txt

But, I am wondering what if your username is lets say sjobs@apple.com

Would i write the url like this:

ftp://sjobs@apple.com:funpassword@ftp.apple.com/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:password@example.com when the username is dog@cat.com.

Thanks Cyrus

回答1:

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



标签: php ftp