curl 的一些用法

  1. curl -o|--output $filename 或 curl > filename # 保存网页至filename

  2. curl -O|--remote-name $url # e.g. curl -O -O

  3. curl -I|--head # 发送 HEAD 方法给 http server, 显示 header 信息

  4. curl -i|--include $url # 输出中包含 HTTP-header 信息

  5. curl -D|--dump_header $filename $url # 把 response header 信息写入文件

  6. curl -L|--location # follow redirect

  7. curl -A|--user-agent "[User Agent]" # 设置User Agent

  8. curl -e|--referer $referer $url # 设置 $referer

  9. curl -b|--cookie "NAME1=VALUE1; NAME2=VALUE2" $url # 设置 cookie

  10. curl -H|--header 'Content-type:application/xml' $url # 设置 request header 信息

  11. curl -v|--verbose $url # curl HTTP 详情

  12. curl -x|--proxy <[protocol://][user@password]proxyhost[:port]>

    # This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to "" to override it.

  13. curl --socks5

  14. curl -w|--write-out <format>

    curl -w 'DNS lookup: %{time_namelookup}\nTCP handshake: %{time_connect}\nSSL handshake: %{time_appconnect}\nPre tran:%{time_pretransfer}\nTran:%{time_starttransfer}\n' # time_connect变量表示TCP握手的耗时,time_appconnect变量表示SSL握手的耗时 `

  15. curl -X|--request # e.g: curl -X POST

  16. curl --data-binary @$file|$str $url # to post data purely binary, post $url $file or $str

  17. curl -d|--data|--data-ascii @$file|$str $url # post $url $file or $str

  18. curl --data-urlencode @$file|$str $url # (HTTP) similar to the other --data options with the exception that this performs URL-encoding.

  19. curl -F|--form # POST data 使用 Content-Type multipart/form-data.

    e.g: curl -F password=@/etc/passwd

    e.g: curl -F "web=@index.html;type=text/html"

    e.g: curl -F "file=@localfile;filename=nameinpost"

    e.g: curl -F file=@file1 -F file=@file2

vi .curlrc
添加socks5 = ""


这篇文章: 有用 无用
创建 2014-02-25 07:50:35 / 更新 2017-08-07 02:39:37