都是最基础的,经常使用到的curl指令和选项。
curl https://www.baidu.com/
curl --head https://www.baidu.com/
返回
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 277
Content-Type: text/html
Date: Wed, 21 Dec 2022 08:43:26 GMT
Etag: "575e1f7d-115"
Last-Modified: Mon, 13 Jun 2016 02:50:37 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
返回页面内容大小,内容类型等等元数据信息
curl -d "name=username&password=123456"
curl --cookie "name=xxxx;pwd=yyy"
比如,
curl "http://192.168.1.66:7070/kylin/api/query" --cookie "JSESSIONID=6285F437878938CD9CB2AA6A583EC7A9;project=learn_kylin" -H "content-type: application/json" -d '{"sql":"select sum(price),LSTG_SITE_ID from kylin_sales group by LSTG_SITE_ID","offset":0,"limit":50000,"acceptPartial":true,"project":"learn_kylin"}'
保持文件名
curl --remote-name "https://example.com/linux-distro.iso"
重命名
curl --remote-name "http://example.com/index.html" --output foo.html
curl https://www.cnblogs.com/ |
grep --only-matching 'src="[^"]*.[png]"' |
cut -d" -f2 |
while read i; do curl https://www.cnblogs.com/"${i}"
-o "${i##*/}"; done
curl -s http://url/yourscript.sh
页面更新:2024-05-12
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号