curl的用法汇总

0.引用

curl的用法

curl用于各种协议 

1.curl简介

cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所
以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。

curl(CommandLine Uniform Resource Locator)

2.curl的学习

man curl

3.curl常用介绍

curl 127.0.0.1:8080 -v  查看请求的头部及body信息,返回头部及body的信息
curl 127.0.0.1:8080 -I  查看返回的头部信息
curl 127.0.0.1:8080     查看返回的body信息
curl -I -X POST 127.0.0.1:8080 只看http返回的头信息

https://blog.csdn.net/lc11535/article/details/103037167?utm_medium=distribute.pc_relevant.none-task-blog-title-2&spm=1001.2101.3001.4242


请求体等详解
https://blog.csdn.net/u010256388/article/details/68491509?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522160532399219724842944083%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=160532399219724842944083&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v28-2-68491509.pc_search_result_cache&utm_term=%E8%AF%B7%E6%B1%82%E5%A4%B4&spm=1018.2118.3001.4449

4. -d的用法(可以用来发送POST请求)

-d, --data <data>
              (HTTP) Sends the specified data in a POST request to the HTTP server, 
              in the same way that a browser does when a user has filled in an  HTML
              form and presses the submit button. This will cause curl to pass the 
              data to the server using the content-type application/x-www-form-urlen‐
              coded.  Compare to -F, --form.

              -d, --data is the same as --data-ascii. To post data purely binary, you
               should instead use the --data-binary option. To URL-encode the value
              of a form field you may use --data-urlencode.

              If any of these options is used more than once on the same command line, 
              the data pieces specified will be merged together with a separating
              &-symbol. Thus, using '-d name=daniel -d skill=lousy' would generate 
              a post chunk that looks like 'name=daniel&skill=lousy'.

              If you start the data with the letter @, the rest should be a file name 
              to read the data from, or - if you want curl to read the  data  from
              stdin.   The contents of the file must already be URL-encoded. Multiple 
              files can also be specified. Posting data from a file named 'foobar'
              would thus be done with --data @foobar.

curl --insecure -u admin:Harbor12345  -H "Content-Type: application/json" -d '{"name":"v4.0.0"}' https://10.21.37.104:8443/api/v2.0/projects/middleware/repositories/redis/artifacts/sha256:90f7eba398a51eea8c92718ced52f90433e53573d199fa1f6a6e9aa61ab56875/tags


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值