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

2019-08-05 10:43发布

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

标签: php ftp
1条回答
趁早两清
2楼-- · 2019-08-05 11:33

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

查看更多
登录 后发表回答