curl 使用笔记

 1、使用案例web

curl -H "cookie:userName=shangyy" www.baidu.comruby

 

2、使用服务器

一、从Netscape的网页服务器上得到该网站的主页:

curl http://www.netscape.com/

二、从futnet的ftp服务器的用户主目录得到指定文件:README

curl ftp://ftp.funet.fi/README

三、使用服务器的8000端口得到web主页:

curl http://www.weirdserver.com:8000/

四、列出ftp站点目录中的文件:

curl ftp://cool.haxx.se/

五、从字典查询网站得到词条curl的定义:

curl dict://dict.org/m:curl

六、次性操做取得二份文档:

curl ftp://cool.haxx.se/ http://www.weirdserver.com:8080/

七、从FTPS服务器上获取文件:

curl ftps//files.are.secure.com/secrets.txt

或者使用推荐的方法访问FTPS服务器来执行相同的操做:cookie

curl --ftp-ssl  ftp//files.are.secure.com/secrets.txt

八、使用SFTP从一个SSH服务器上获取一份文件:

curl -u username sftp://example.com/etc/issue

九、从一台使用私钥认证(私钥未使用密码保护)的SSH服务器上使用SCP获取一份文件:

curl -u username: --key ~/.ssh/id_rsa \ scp://example.com/~/file.txt

十、从一台使用私钥认证(私钥使用密码保护)的SSH服务器上使用SCP获取一份文件:

curl -u username: --key ~/.ssh/id_rsa --pass private_key_password \ scp://example.com/~/file.txt

十一、从一台使用IPv6的网页服务器上得到站点主页:

curl "http://[2001:1890:1112:1::20]/"

十二、从一台Samba文件服务器上得到文件:

curl -u "domain\username:passwd" smb://server.example.com/share/file.txt