分类 curl 中的文章

CentOS 升级 Curl 为最新版本

一、查看CentOS 版本号 cat /etc/redhat-release 二、下载 repo 包 根据以下查到的版本号,到 http://www.city-fan.org/ftp/contrib/yum-repo/ 查找对应版本的 rpm 如 CentOS Linux release 7.6.1810 (Core) ,执行以下命令下载: rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm 三、更新 Curl // 将 city-fan.org.repo 中的 enabled=1 更新为 enabled=0 vim /etc/yum.repos.d/city-fan.org.repo // 更新 yum --enablerepo=city-fan.org update curl ……

阅读全文

curl命令行

GET请求 GET请求只需要在curl命令后加待请求的URL即可。 curl url eg: curl ‘http://github.com’ POST请求 POST请求格式稍显复杂 curl -H “Content-Type: application/json” -X POST –data ‘json 报文’ url eg: curl -H “Content-Type: application/json” -X POST –data ‘{“app: “curl”}’ http://google.com 过程时间 计算整个过程时间: -w %{time_total} 其它时间: -w:按照后面的格式写出rt time_namelookup:DNS 解析域名[www.tn.com]的时间 time_commect:client和server端建立TCP 连接的时间 time_starttransfer:从client发出请求;到web的server 响应第一个字节的时间 time_total:client发出请求;到web的server发送回所有的响应数据的时间 speed_download:下周速度 单位 byte/s eg: 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" -H “Content-Type: application/json” -X POST –data ‘json data’ url ……

阅读全文