易陆发现互联网技术论坛

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

curl get和post请求 curl -s

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

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

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

x
GET 请求/ |# y4 u' _2 L' x. Z" w* u
curl "http://www.example.com"    # 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
/ z( @5 R7 t* R" V8 a+ {9 j$ @( Acurl -i "http://www.example.com" # 显示全部信息) E4 v0 B# I( t" \+ z; G
curl -l "http://www.example.com" # 显示页面内容& c) s, p2 W' f9 o# N
curl -v "http://www.example.com" # 显示get请求全过程解析& y" @. C. E1 _2 E6 \

7 n) A8 I& M* c# W, hPOST 请求: T% ?" \' ~; }. V$ R0 p2 L
$ curl -d "param1=value1&param2=value2" "http://www.test.com/login"; S: {. Q! v) h( S' ~  u
3 a4 l4 T) W" o+ z5 ]: X3 i# ^
$ curl -d'login=emma&password=123' -X POST https://test.com/login
: @7 }$ ^) \4 s2 V! n1 ^  v6 a# 或者9 v& T3 z! N  [
$ curl -d 'login=emma' -d 'password=123' -X POST  https://test.com/login
; @% B6 f  x2 [$ B' ?
1 B! k. i8 \8 H1 _2 ^# J* h
, J* X9 S* T7 p  ^
 楼主| 发表于 2023-11-30 11:00:02 | 显示全部楼层
curl -s  https://www.baidu.com 3 y& @2 h( c$ C& c& W( b
<!DOCTYPE html>! G8 r  c7 L1 c  J
<!--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>');
% y( ^/ Q" L9 B  d# ]5 ^2 F; M                </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>
& o4 t+ s" D) v( H8 z
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 15:28 , Processed in 0.039093 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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