curl no-cache
d:\Users\Administrator\Desktop\curl-7.73.0_3-win64-mingw\bin>curl -Iv http://abc.gkmang.cn:8081/index.php/login -H "Cache-Control: no-cache,no-store"
curl -kv --user 'apixxxx':'xxxxxx' https://.gateway.com:5015/restconf/data/huawei-security-blacklist:security-blacklist/
* About to connect() to cf0fxxxxxxx3cf0f5c99916544f3.gateway.com port 5015 (#0)
* Trying 10.0.1.230...
* Connected to cf0fxxxxxxx3.gateway.com (10.0.1.230) port 5015 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=LOCAL-1021C0013081,OU=VPN,O=HW,L=NJ,ST=JS,C=CN
* start date: Dec 28 13:38:36 2021 GMT
* expire date: Dec 26 13:38:36 2031 GMT
* common name: LOCAL-1021C0013081
* issuer: CN=CA-1021C0013081,OU=VPN,O=HW,L=NJ,ST=JS,C=CN
* Server auth using Basic with user 'api-admin'
> GET /restconf/data/huawei-security-blacklist:security-blacklist/ HTTP/1.1
> Authorization: Basic YXBpLWFkbWluOkh1YXdlaTEyMw==
> User-Agent: curl/7.29.0
> Host: cf0fxxxxxxx3.gateway.com:5015
> Accept: */*
>
< HTTP/1.1 200 OK
< Date:Fri Jul 14 09:55:06 2023
< Server:Restconf-server
< Content-Type:application/yang-data+xml
< Content-Length:763
< Last-Modified:Thu Jul 6 16:25:57 2023
< ETag:"f62cb7d3c34d0"
<
* Connection #0 to host cf0f5c99916544f3.gateway.com left intact
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><data><security-blacklist xmlns="urn:huawei:yang:huawei-security-blacklist"><vsys><name>public</name><enable>true</enable><source-items><source-ip>9.9.9.9</source-ip><source-port>0</source-port><protocol>any</protocol><aging-time>10</aging-time><refresh>false</refresh></source-items><source-items><source-ip>8.8.8.8</source-ip><source-port>0</source-port><protocol>any</protocol><aging-time>10</aging-time><refresh>false</refresh></source-items><destination-items><destination-ip>10.10.10.10</destination-ip><destination-port>0</destination-port><protocol>any</protocol><aging-time>10</aging-time><refresh>false</refresh></destination-items></vsys></security-blacklist></data></rpc-reply>[root@ecs-aa8b ~]#
或
curl -kv -H 'Authorization: Basic YXBpLWFkbWluOkh1YXdlaTEyMw==' https://cf0f5c9xxx.com
curl post
cat usgpostblackip | curl -kv --user 'xxx':'xxxx' -X POST -H 'Content-Type: application/yang-data+xml' -d @- https://abc.com
#curl post xml报文
echo 'xxxx '| curl -X POST -H 'Content-type:text/xml' -d @- http://1.1.1.1:8081/loginregistration/register
cat 1.xml | curl -X POST -H 'Content-type:text/xml' -d @- http://1.1.1.1::8081/httpInvokeServlet
注解: xxxx是xml报文内容 1.xml 报文文件 @- 读取管道符内容
#curl post json 报文
curl -H "Content-Type:application/json" -X POST --data 'xxxx' http://1.1.1.1:18080/
cat 1.json | curl -H "Content-Type:application/json" -X POST -d @- http://1.1.1.1:8081/httpInvokeServlet
注解: xxxx是json报文内容 1.json 报文文件 @- 读取管道符内容
curl post
curl -kv --user 'xxxx':'xxxx' -X POST -H 'Content-Type: application/yang-data+xml' -d '<source-items><source-ip>30.30.40.60</source-ip><source-port>0</source-port><protocol>any</protocol><aging-time>0</aging-time><refresh>false</refresh></source-items>' https://abc.com
curl 指定host ip 访问页面或接口
curl -H 'Host:www.test.com' http://10.44.54.111/test.php
或
curl -x 10.44.54.111:80 http://www.test.com/test.php
-s,静默,不显示进度表。
-o /dev/null 请求输出重定向到/dev/null.
http: %{http_code}\n
dns: %{time_namelookup}s\n
redirect: %{time_redirect}s\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_redirect: %{time_redirect}\n
time_pretransfer: %{time_pretransfer}\n
time_starttransfer: %{time_starttransfer}\n
size_download: %{size_download}bytes\n
speed_download: %{speed_download}B/s\n
----------\n
time_total: %{time_total}\n
time_namelookup:DNS解析时间,从请求开始到DNS解析完毕所用的时间。
time_connect:连接时间,从开始到建立TCP连接完成所用时间,包括前边DNS解析时间,如果需要单纯的得到连接时间,time_connect时间减去time_namelookup时间。
time_appconnect:连接建立完成时间;如SSL/SSH等建立连接或者完成三次握手时间。
time_pretransfer:从开始到准备传输的时间。
time_starttransfer:开始传输时间。在client发出请求之后,web服务器返回数据的第一个字节所用的时间。
time_total:client发出请求到web的server发送完所有的相应的数据的时间。
参考: