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

curl get和post请求 curl -s

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-11-30 11:00:01 | 显示全部楼层 |阅读模式
GET 请求
9 h+ |# f% f  j) [- h6 k& t( {2 bcurl "http://www.example.com"    # 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
, Z% B$ R6 }0 R$ rcurl -i "http://www.example.com" # 显示全部信息
+ F. R3 T5 u+ N' Fcurl -l "http://www.example.com" # 显示页面内容
0 q# W; X! h- q  J* P0 W4 C* \curl -v "http://www.example.com" # 显示get请求全过程解析
, B6 p1 c/ g! W& k+ @4 ]9 B9 l
2 E+ w4 c& U! f$ yPOST 请求) f' t# w( J, q8 \2 Q  {& B
$ curl -d "param1=value1&param2=value2" "http://www.test.com/login"
* _1 v. x) n. {
6 j4 {3 @  g8 \5 T$ curl -d'login=emma&password=123' -X POST https://test.com/login
# b+ m% T  Q8 H- ]$ V# 或者8 e2 m$ _7 e1 S  @& ^* S' U+ A
$ curl -d 'login=emma' -d 'password=123' -X POST  https://test.com/login2 o  m/ o+ Q3 A& v& b$ D% V
, @# `  R5 B$ Q

7 [. `/ B9 Q4 g" p8 [. U

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-11-30 11:00:02 | 显示全部楼层
curl -s  https://www.baidu.com 7 k1 N  k! t. A5 _8 M! c! f' I
<!DOCTYPE html>1 F+ p  Y8 X/ ]. R4 Z+ Q
<!--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>');' w; C# @+ Q2 L" ?) V1 D
                </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>
& j! b5 A: g9 w# ?: C
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 02:09 , Processed in 0.021783 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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