curl 使用示例 详细
NAME
curl - transfer a URL
SYNOPSIS
curl [options] [URL...]
DESCRIPTION
curl is a client to get documents/files from or send documents to a server,
using any of the supported protocols (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP or FILE).
The command is designed to work without user interaction or any kind of interactivity.
curl offers a busload of useful tricks like proxy support, user authentication, ftp upload,
HTTP post, SSL (https:) connections,cookies, file transfer resume and more.
URL
The URL syntax is protocol dependent. You'll find a detailed description in RFC 2396.
查看响应头
curl -I http://www.bbc.com
保存到文件
curl -o filename http://www.bbc.com
绑定ip测试
curl -X"GET" -H"Host: tools.bbc.com" -O http:/shenfenzheng.htm
从ftp下载
curl -u test:test -O ftp:/a.txt
或curl -O ftp://test:test@*.*.*.*:21/zhuh.txt
-O Write output to a file named as the remote file
上传至ftp
curl -T ./t.xt ftp://test:test@*.*.*.*:21/
指定referer
curl -e http://www.baidu.com http://www.bbc.com
代理
curl "http://iframe.ip138.com/ic.asp"
curl -x *.*.*.*:3333 "http://iframe.ip138.com/ic.asp"
保存cookie
curl -c ./cookie01 http:/setCookie.php
或curl -D ./dumpheader http:/setCookie.php
发送cookie到服务器
curl -b ./cookie01 http:/showCookie.php
指定UA
curl -v -A "User-AgentMozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"http://8.8.8.8/setCookie.php
续传
curl -C -O http://download.bbc.com/Setup_V2.4.exe
分块多进程下载
curl -r 0-1024000 -o "ie1" http://download.bbc.com/Setup_V2.4.exe &\
curl -r 1024001-2048000 -o "ie2" http://download.bbc.com/Setup_V2.4.exe &\
curl -r 2048001-4096000 -o "ie3" http://download.bbc.com/Setup_V2.4.exe &\
curl -r 4096001- -o "ie4" http://download.bbc.com/setupV2.4.exe &
cat ie* > ie.exe
使用POST方式提交表单
curl -d"cmd=login" -d"password=af8f9dffa5d420fbc2491416962ee" -d"username=testcurl"http://login.bbc.com/login.php
取状态码
curl -o /dev/null -s -w"%{http_code},%{time_total}" http://www.bbc.com
最新文章
- [Sass]声明变量
- SQL-表的各种查查查
- jquery CRUD一个元素class属性
- java分页问题
- 20151210study
- 使用XSD校验Mybatis的SqlMapper配置文件(1)
- gocode+auto-complete搭建emacs的go语言自动补全功能
- CSS成长之路----知识点篇
- HackerRank ";New Year Chaos";
- C#中的集合
- InstallShield Limited Edition for Visual Studio 2013
- 编程内功修炼之数据结构—BTree(二)实现BTree插入、查询、删除操作
- BaseAdapter 注意的关键点!
- html语法之--使用图像映射
- spoj ONP - Transform the Expression 中缀转后缀
- Java 脚本化编程指南
- 剑指Offer_编程题_13
- day64 django django零碎知识点整理
- Linux操作系统配置Go语言编程环境
- 关于ionic如何到最新版本