Curl使用

Posted by Ricky Blog on March 26, 2025
1
curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n"  https://blog.yessure.org/
  • time_total: 访问url总时间

携带referer

curl -so /dev/null -v 'https://example.com/web/home/feature_3_bg.png' -H 'referer: http://servicewechat.com/'

curl 模拟websocket

curl --no-buffer -H 'Connection: keep-alive, Upgrade' -H 'Upgrade: websocket' -v -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: websocket' -H 'Host: www.example.com' https://ip/api/WebSocket/c5b-8d87-c94b5514f83a ws | od -t c

curl POST

1
2
3
4
5
6
7
8
9
10
11
12
curl --location --request POST 'http://localhost:11434/v1/chat/completions' \
--header 'Authorization: Bearer abc' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "qwen2.5:0.5b",
  "messages": [
    {
      "role": "user",
      "content": "你好,你是谁"
    }
  ]
}'

https://zahui.fan/posts/lqyxid2z/