1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - Linux系统 - 正文

君子好学,自强不息!

可能大家还对“linux中curl命令详解 linux中route命令详解”有些不明白,下面由1818ip小编来为大家解答一下,现在我们来一起看看吧!

linux中curl命令的使用详情:

1、curl url(获取该网址的文本信息)

curl www.zhujy.com

这就是获取的www.zhujy.com信息

Welcome to nginx!

    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }



Welcome to nginx!

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

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

2、curl -i url(获取该网址的文本信息以及协议头部信息)

这就是获取的www.zhujy.com文本信息以及协议头部信息。

HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Mon, 11 Mar 2019 02:06:55 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 29 Oct 2018 09:52:22 GMT
Connection: keep-alive
ETag: "5bd6d856-264"
Accept-Ranges: bytes
Welcome to nginx!

    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }



Welcome to nginx!

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

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

3、curl -x proxy url(使用代理获取网页文本信息)

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 ]

4、curl -X POST –header”Content-Type:application/json” –data ‘{}’ url (使用post模拟json格式请求接口)

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":"24793d7c-e199-11e8-ba67-00163e14685b","name":"tom","age":"18","address":"北京3","stage":"NBA"},{"id":"247acf89-e599-11e8-ba67-00163e14685b","name":"jerry","age":"18","address":"深圳22","stage":"NBA"},{"id":"247cdafc-e599-11e8-ba67-00163e14685b","name":"james","age":"38","address":"广州d4","stage":"NBA"},{"id":"247ed96c-e599-11e8-ba67-00163e14685b","name":"curry","age":"58","address":"上海fv","stage":"NBA"},{"id":"24805b4e-e599-11e8-ba67-00163e14685b","name":"kaven","age":"78","address":"陇县","stage":"NBA"},{"id":"2481f851-e599-11e8-ba67-00163e14685b","name":"durant","age":"68","address":"富平","stage":"NBA"}]}}

POST 指定请求方式

–header 指定请求头部信息

–data 指定json请求体数据内容

5、curl -I url(仅返回请求头部信息)

curl -I www.zhujy.com.cn
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Mon, 11 Mar 2019 03:34:29 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 29 Oct 2018 09:52:22 GMT
Connection: keep-alive
ETag: "5bd6d856-264"
Accept-Ranges: bytes

以上就是“linux中curl命令详解 linux中route命令详解”的详细内容,更多请关注1818ip网其它相关文章!

本文来源:1818IP

本文地址:https://www.1818ip.com/post/3814.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。