找回密码
 注册
查看: 94|回复: 1

curl get和post请求 curl -s

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-11-30 11:00:01 | 显示全部楼层 |阅读模式
GET 请求
# z9 f- k. a6 p0 E7 qcurl "http://www.example.com"    # 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
; u; ^4 d& `2 ~% _! O% Z( e7 ]$ ecurl -i "http://www.example.com" # 显示全部信息
2 n! h9 J# K' t* n+ bcurl -l "http://www.example.com" # 显示页面内容
" @  J( q2 b# mcurl -v "http://www.example.com" # 显示get请求全过程解析
0 P/ f1 n  e* }8 w
6 z) h+ @; l  q& B8 NPOST 请求
; j2 w/ A& K8 ]& Z! k5 e9 r9 k  }$ curl -d "param1=value1&param2=value2" "http://www.test.com/login"
& H# A  n1 M+ _
2 g- ~' a# w2 [5 k0 {2 C$ A$ curl -d'login=emma&password=123' -X POST https://test.com/login
: F6 y4 ]+ f, E* p0 |# 或者  x; [/ h3 J7 I
$ curl -d 'login=emma' -d 'password=123' -X POST  https://test.com/login
( I6 ^) u7 f: Z0 Y8 M. F: G1 R3 @! j& o) h; {
$ Z0 ]3 T8 d2 u- ~8 `5 [# U

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-11-30 11:00:02 | 显示全部楼层
curl -s  https://www.baidu.com
4 s* r( r& n  ~, X( J<!DOCTYPE html>
3 i! l1 D5 I9 M! l/ o8 Q1 X<!--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>');
' o# l  X. V9 V                </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>
4 s' x: s- p: U5 x2 s
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:05 , Processed in 0.020082 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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