博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
curl命令介绍
阅读量:4095 次
发布时间:2019-05-25

本文共 3253 字,大约阅读时间需要 10 分钟。

  1. curl url(获取该网址的文本信息)
这就是获取的www.zhujy.com信息Welcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.

Commercial support is available atnginx.com.

Thank you for using nginx.

  1. curl -i url(获取该网址的文本信息以及协议头部信息)
这就是获取的www.zhujy.com文本信息以及协议头部信息。HTTP/1.1 200 OKServer: nginx/1.14.0Date: Mon, 11 Mar 2019 02:06:55 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Mon, 29 Oct 2018 09:52:22 GMTConnection: keep-aliveETag: "5bd6d856-264"Accept-Ranges: bytesWelcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.

Commercial support is available atnginx.com.

Thank you for using nginx.

  1. curl -x proxy url(使用代理获取网页文本信息)
curl -x 47.94.151.148:80 zhujy.com.cn
            Test Page for the Nginx HTTP Server on Fedora        

Welcome to nginx on Fedora!

This page is used to test the proper operation of the nginx HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly.

Website Administrator

This is the default index.html page that is distributed with nginx on Fedora. It is located in /usr/share/nginx/html.

You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.

[ Powered by nginx ]
[ Powered by Fedora ]
  1. curl -X POST --header"Content-Type:application/json" --data ‘{}’ url (使用post模拟json格式请求接口)
  2. POST 指定请求方式
  3. header 指定请求头部信息
  4. data 指定json请求体数据内容
#post请求curl -X POST --header "Content-Type:application/json"  --data '{}'  127.0.0.1:8088/user/getAllUserInfo#响应{"resultCode":"0","resultMsg":"成功","data":{"userList":[{"id":"a6fc8f27-e598-11e8-ba67-00163e14685b","name":"tom","age":"18","address":"北京1","stage":"NBA"},{"id":"2481f851-e599-11e8-ba67-00163e14685b","name":"durant","age":"68","address":"富平","stage":"NBA"}]}}
  1. curl -I url(仅返回请求头部信息)
HTTP/1.1 200 OKServer: nginx/1.14.0Date: Mon, 11 Mar 2019 03:34:29 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Mon, 29 Oct 2018 09:52:22 GMTConnection: keep-aliveETag: "5bd6d856-264"Accept-Ranges: bytes

curl支持所有Http请求方法(get、post、put、delete等),只要通过-x参数指定即可

  1. 使用DELETE请求
    curl -X DELETE itbilu.com/examlple.html
  2. 使用PUT请求,并指定请求数据,-H:指定请求头参数,-d:–data HTTP POST方式传送数据
    curl -X PUT “localhost:9200/customer/_doc/1?pretty” -H ‘Content-Type: application/json’ -d’{“name”: “John Doe”}’
  3. 使用GET请求
    curl -X GET “localhost:9200/_cat/health?v”
  4. 使用POST请求
    curl -X POST “localhost:9200/customer/_doc/1/_update?pretty” -H ‘Content-Type: application/json’ -d’{“doc”: { “name”: “Jane Doe”, “age”: 20 }}’

转载地址:http://tmtii.baihongyu.com/

你可能感兴趣的文章
谈谈加密和混淆吧[转]
查看>>
乘法逆元
查看>>
Objective-C 基础入门(一)
查看>>
找工作准备的方向(4月22日写的)
查看>>
关于fwrite写入文件后打开查看是乱码的问题
查看>>
用结构体指针前必须要用malloc,不然会出现段错误
查看>>
Linux系统中的美
查看>>
一些实战项目(linux应用层编程,多线程编程,网络编程)
查看>>
STM32CubeMX 真的不要太好用
查看>>
不要买铝合金机架的无人机,不耐摔,易变形弯曲。
查看>>
ACfly也是基于FreeRTOS的
查看>>
电机堵转
查看>>
carzepony也在想往FreeRTOS上迁移
查看>>
思岚A1的SDK其实很好读懂,每个函数清晰明了,可以直接调用
查看>>
去github里面找找也没有别人无人机+SLAM的工程
查看>>
现在明白为什么无名博客里好几篇文章在讲传感器的滞后
查看>>
ROS是不是可以理解成一个虚拟机,就是操作系统之上的操作系统
查看>>
用STL algorithm轻松解决几道算法面试题
查看>>
ACfly之所以不怕炸机因为它觉得某个传感器数据不安全就立马不用了
查看>>
我发觉,不管是弄ROS OPENCV T265二次开发 SDK开发 caffe PX4 都是用的C++
查看>>