千家信息网

linux中curl命令的使用案例

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,这篇文章主要介绍linux中curl命令的使用案例,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!linux中curl命令的使用详情:1、【curl url】获取该网址的文本信息
千家信息网最后更新 2025年02月01日linux中curl命令的使用案例

这篇文章主要介绍linux中curl命令的使用案例,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

linux中curl命令的使用详情:1、【curl url】获取该网址的文本信息;2、【curl -i url】获取该网址的文本信息以及协议头部信息;3、【curl -x proxy url】使用代理获取网页文本信息。

linux中curl命令的使用详情:

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

curl www.zhujy.com

这就是获取的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.

2、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.

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 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

以上是linux中curl命令的使用案例的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!

信息 文本 头部 命令 网址 内容 案例 就是 网页 详情 北京 代理 成功 价值 兴趣 小伙 小伙伴 接口 数据 方式 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 网络技术会涉及到的英文 运城软件开发价格 php7 数据库连接 mc手机版国际版服务器地址 绍兴迅极网络技术开发 地狱已满 服务器 浦东新区上门软件开发报价表 csgo查服务器地区 惠山区智能化软件开发联系方式 网络安全与渗透实习工资 河南网络安全与信息管理培训机构 中国 服务器 厂商 数据库映射有用吗 数据库与测试软件的关系 域名服务器主要功能实现什么转换 陶云网络技术有限公司 万人服务器游戏 明日之后各服务器营地排行 软件开发标准工时四个维度 永定区索瑜毅网络技术工作室 java实现服务器控制多个视频 双随机一公开网络安全 苏州c语言软件开发怎么样 软件开发需要学会数据库吗 奉贤区智能软件开发服务 数据库的删改查是什么意思 数据库工作岗位浪潮 通信与网络技术课程的重要性 水星wifi服务器无法连接 盐城集中式分布式存储数据库
0