shell神器curl命令的用法 curl用法实例笔记

shell神器curl命令的用法举例,如下:

##基本用法(配合sed/awk/grep)
$curl http://www.jquerycn.cn

##下载保存
$curl http://www.jquerycn.cn > index.html
$curl -o index.html http://www.jquerycn.cn
$curl -O http://www.jquerycn.cn/target.tar.gz

##通过代理
$curl -x 123.45.67.89:1080 -o page.html http://www.jquerycn.cn

##保存cookie
$curl -x 123.45.67.89:1080 -o page1.html -D cookie0001.txt http://www.jquerycn.cn

##使用cookie
$curl -x 123.45.67.89:1080 -o page1.html -D cookie0002.txt -b cookie0001.txt http://www.jquerycn.cn

##模仿浏览器
$curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -x 123.45.67.89:1080 -o page.html -D cookie0001.txt http://www.jquerycn.cn

##伪造referer
$curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -x 123.45.67.89:1080 -e "mail.yahoo.com" -o page.html -D cookie0001.txt http://www.jquerycn.cn

##循环下载
$curl -O http://www.jquerycn.cn/~zzh/screen[1-10].JPG

##循环(匹配)下载
$curl -O http://www.jquerycn.cn/~{zzh,nick}/[001-201].JPG  # >like zzh/001.JPG 

##循环(引用)下载
$curl -o #2_#1.jpg http://www.jquerycn.cn/~{zzh,nick}/[001-201].JPG # like >001_zzh.jpg

##断点续传
$curl -c -O http://cgi2.tky.3wb.ne.jp/~zzh/screen1.JPG  

##分块下载
$curl -r  0 - 10240  -o  "zhao.part1"  http://www.jquerycn.cn/~zzh/zhao1.mp3 &\
$curl -r 10241 - 20480  -o  "zhao.part1"  http://www.jquerycn.cn/~zzh/zhao1.mp3 &\
$curl -r 20481 - 40960  -o  "zhao.part1"  http://www.jquerycn.cn/~zzh/zhao1.mp3 &\
$curl -r 40961 - -o  "zhao.part1"  http://www.jquerycn.cn/~zzh/zhao1.mp3
...
$cat zhao.part* > zhao.mp3

##GET 上传
$curl http://www.yahoo.com/login.cgi?user=nickwolfe&password=12345   

##POST 上传
$curl -d "user=nickwolfe&password=12345" http://www.yahoo.com/login.cgi 

##POST 文件上传
$curl -F upload= $localfile  -F $btn_name=$btn_value http://www.jquerycn.cn/~zzh/up_file.cgi
时间: 2024-08-29 03:42:07

shell神器curl命令的用法 curl用法实例笔记的相关文章

【转】linux curl 命令详解,以及实例

原文链接 http://www.codesky.net/article/201010/170043.html linux curl是一个利用URL规则在命令行下工作的文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具. 一,curl命令参数,有好多我没有用过,也不知道翻译的对不对,如果有误的地方,还请指正. -a/--append 上传文件时,附加到目标文件 -A/--user-agent <string> 设置用户代理发送给服务器 - anyauth

linux curl 命令详解,以及实例

linux curl是一个利用URL规则在命令行下工作的文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具. 一,curl命令参数,有好多我没有用过,也不知道翻译的对不对,如果有误的地方,还请指正. -a/--append 上传文件时,附加到目标文件 -A/--user-agent <string>  设置用户代理发送给服务器 - anyauth   可以使用“任何”身份验证方法 -b/--cookie <name=string/file>

curl命令之ftp上传实例

The simplest way to access a ftp server with username and password curl ftp://myftpsite.com --user myname:mypassword </span> With the command line above, curl will try to connect to the ftp server and list all the directories and files in the ftp ho

Curl命令简介

相关1:http://blog.csdn.net/windows_nt/article/details/9630567 相关2:http://php.net/manual/zh/function.curl-setopt.php 1.使用curl命令发送post数据: curl -d '{post内容}' ip(或域名)/path?get参数 如:curl -d '{post内容}' baidu.com/ask?p=xx 2.使用curl命令发送get数据 curl '请求url' 3.c++下使

windows下使用curl命令&amp;&amp;常用curl命令

什么是curl命令? curl是利用URL语法在命令行方式下工作的开源文件传输工具.它被广泛应用在Unix.多种Linux发行版中,并且有DOS和Win32.Win64下的移植版本. 如何在windows下使用curl命令? https://curl.haxx.se/windows/ 第一步: 进入curl下载官网,下载合适的版本,我这里下载的是windows 64位的curl. 其中我下载的zip文件. 另外CAB文件也是压缩文件,这是微软出品,不太好用,建议使用zip压缩文件. 第二步: 解

curl命令用法

例: char buf[512] = { 0 };sprintf(buf,"curl %s/NewWanbu/App/Api/index.php/Report/sEmail/aid/%d/reportType/final/",g_profile.m_confData.m_url.c_str(),activeID); //curl http://wanbu.lvzy/NewWanbu/App/Api/index.php/Report/sEmail/aid/3429/reportType/

curl命令常见用法

原博主:http://www.cnblogs.com/duhuo/p/5695256.html    都市烟火  ,敬请关注 在Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具.它支持文件的上传和下载,是综合传输工具,但按传统,习惯称url为下载工具. 语法:# curl [option] [url] 常见参数: -A/--user-agent <string> 设置用户代理发送给服务器 -b/--cookie <name=st

curl命令的用法

curl 命令详解 命令事例 发送POST请求: 如果传输文件:curl -F "[email protected];type=text/plain" localhost:8080/request_body 普通post请求:curl -d "method=searchone&module=seller&user_name=wb-liqiu&nickname=dd" -H"Host:fmp.view.lz.taobao.com&qu

Linux下命令行cURL的10种常见用法示例

在Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具.它支持文件的上传和下载,是综合传输工具,但按传统,习惯称url为下载工具. 语法: # curl [option] [url] 1. 获取页面内容 当我们不加任何选项使用 curl 时,默认会发送 GET 请求来获取链接内容到标准输出. curl http://www.baidu.com 2. 显示 HTTP 头 如果我们只想要显示 HTTP 头,而不显示文件内容,可以使用 -I 选项