内容简介:cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。 – BaiduDICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTPRef
cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。 – Baidu
0x01 cURL支持的协议
DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP
Ref:https://ec.haxx.se/protocols-curl.html
0x02 常用选项
curl -v http://example.com curl -L http://example.com curl -d "username=Rvn0xsy" http://example.com curl -o ~/Download/down.zip http://example.com/download.zip curl -s -o ~/Download/down.zip http://example.com/download.zip curl -O ~/Download/down.zip http://example.com/download.zip curl http://example.com/ --limit-rate 200K curl --max-filesize 100000 http://example.com/ curl --range 100-1099 http://example.com/download.zip curl --data-urlencode "name=John Doe (Junior)" http://example.com curl --data-urlencode user@contents.txt http://example.com #user的内容再contents.txt中 curl -G http://example.com curl -H "Transfer-Encoding: chunked" http://example.com curl --user-agent/-A/-H 'User-Agent: http://example.com'
0x03 认证
cURL支持四种认证:
-u <username:password>
0x04 任意HTTP方法
cURL -X <POST/GET/OPTIONS/PUT> http://example.com
0x04 上传文件
支持:FILE, FTP, FTPS, HTTP, HTTPS, IMAP, IMAPS, SCP, SFTP, SMB, SMBS, SMTP, SMTPS and TFTP.
HTTP: curl -T upload.zip http://example.com/ # PUT
FTP: curl -T upload.zip ftp://example.com/
SMTP: curl -T mail smtp://mail.example.com/ --mail-from user@example.com
0x05 网卡
curl --interface eth1 https://www.example.com/ curl --interface 192.168.0.2 https://www.example.com/ curl --interface machine2 https://www.example.com/
0x06 指定源端口
curl --local-port 4000-4200 https://example.com/
0x07 代理
支持代理:
- http
- socks
curl -x 192.168.0.1:8080 http:/example.com/ curl -x socks4://proxy.example.com http://www.example.com/ curl --socks4 proxy.example.com http://www.example.com/ curl --socks4a proxy.example.com http://www.example.com/ curl -x socks4a://proxy.example.com http://www.example.com/ curl -x socks5://proxy.example.com http://www.example.com/ curl --socks5 proxy.example.com http://www.example.com/ curl -x socks5h://proxy.example.com http://www.example.com/ curl --socks5-hostname proxy.example.com http://www.example.com/
代理认证
curl -U daniel:secr3t -x myproxy:80 http://example.com
0x08 HTML表单上传文件
<form action="submit.cgi" method="post" enctype="multipart/form-data"> Name: <input type="text" name="person"><br> File: <input type="file" name="secret"><br> <input type="submit" value="Submit"> </form>
curl -F person=anonymous -F secret=@file.txt http://example.com/submit.cgi
0x09 COOKIE
读取cookie
curl -L -b cookies.txt http://example.com
将cookie写入文件
curl -c cookie-jar.txt http://example.com
REF
- https://legacy.gitbook.com/book/bagder/everything-curl
以上所述就是小编给大家介绍的《cURL工具的使用技巧》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Apache Tomcat 6高级编程
Vivek Chopra、Sing Li、Jeff Genender / 人民邮电出版社 / 2009-3 / 79.00元
《Apache Tomcat 6高级编程》全面介绍了安装、配置和运行Apache Tomcat服务器的知识。书中不仅提供了配置选项的逐行分析,还探究了Tomcat的特性和功能,可以帮助读者解决出现在系统管理的各个阶段的各种问题,包括共享主机、安全、系统测试和性能测试及调优。 《Apache Tomcat 6高级编程》重点讲解Tomcat 6的应用知识。从基本的Tomcat和Web应用程序配置......一起来看看 《Apache Tomcat 6高级编程》 这本书的介绍吧!