易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 89|回复: 1
收起左侧

curl get和post请求 curl -s

[复制链接]
发表于 2023-11-30 11:00:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
GET 请求
5 |5 u$ T% b4 ecurl "http://www.example.com"    # 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
- ?# h" q0 s/ y% N4 Q+ Gcurl -i "http://www.example.com" # 显示全部信息- g. p' {' i! j+ i$ b
curl -l "http://www.example.com" # 显示页面内容
6 Y" u1 s, f+ E' V2 P2 w  Z9 @curl -v "http://www.example.com" # 显示get请求全过程解析- L' O7 L; |# E  J3 A6 O  U

# T& P6 l/ A: Z* }5 r2 c+ T" u; cPOST 请求; ]! m, O6 m8 i" D/ W! r
$ curl -d "param1=value1&param2=value2" "http://www.test.com/login"
# ]  K) o* P$ v: ^! z6 H8 a0 c. z, F4 V( k# e
$ curl -d'login=emma&password=123' -X POST https://test.com/login- {) _8 R) J1 t9 b2 `" _
# 或者% O& a2 [1 b+ q
$ curl -d 'login=emma' -d 'password=123' -X POST  https://test.com/login
8 l1 k" o- o; K- I- H3 j
- u. e7 y$ e8 p/ V) b/ Z3 T. V
- y1 L! V! h4 m& O8 s
 楼主| 发表于 2023-11-30 11:00:02 | 显示全部楼层
curl -s  https://www.baidu.com : k* ]3 v8 L2 H- C- H& P6 h
<!DOCTYPE html>8 d( ^4 @6 U$ R3 i! {, i
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus=autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn" autofocus></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=https://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');
2 `  a- u1 M7 a% }9 u! U                </script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=http://www.baidu.com/duty/>使用百度前必读</a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>
8 f/ C( B4 L4 |6 R" j
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:31 , Processed in 0.049588 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表