安装CURL
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装CURL相关的知识,希望对你有一定的参考价值。
CURL是用于发出网络请求的命令行工具,支持多种协议。也是测试api的利器。
常用功能有:
查看网页源码:curl www.xxx.xxx
保存网页:curl -o www.xxx.xxx
自动跳转:curl -L www.xxx.xxx
显示头信息:curl -i www.xxx.xxx
显示通讯过程: curl -v www.xxx.xxx, 或保存更详细的通讯过程到输出文件:curl --trace outout.txt www.xxx.xxx
发送表单信息:
GET: curl tvbs.cc/form.cgi?data=xxx
POST: curl --data "key=value" tvbs.cc/form.cgi
文件上传
Referer字段
User Agent字段
Cookie
增加头信息
Http认证
更多的详细的命令查看:https://curl.haxx.se/docs/httpscripting.html
在linux中的安装命令:
[email protected]:/usr/local/tutorial$ sudo apt-get install curl Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libcurl3 The following NEW packages will be installed: curl The following packages will be upgraded: libcurl3 1 upgraded, 1 newly installed, 0 to remove and 23 not upgraded. Need to get 123 kB/296 kB of archives. After this operation, 314 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main curl amd64 7.35.0-1ubuntu2.7 [123 kB] Fetched 107 kB in 17s (6,013 B/s) (Reading database ... 179037 files and directories currently installed.) Preparing to unpack .../libcurl3_7.35.0-1ubuntu2.7_amd64.deb ... Unpacking libcurl3:amd64 (7.35.0-1ubuntu2.7) over (7.35.0-1ubuntu2.6) ... Selecting previously unselected package curl. Preparing to unpack .../curl_7.35.0-1ubuntu2.7_amd64.deb ... Unpacking curl (7.35.0-1ubuntu2.7) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up libcurl3:amd64 (7.35.0-1ubuntu2.7) ... Setting up curl (7.35.0-1ubuntu2.7) ... Processing triggers for libc-bin (2.19-0ubuntu6.9) ... [email protected]:/usr/local/tutorial$
以上是关于安装CURL的主要内容,如果未能解决你的问题,请参考以下文章
CentOS yum 命令出现 [Errno 14] curl#6 - "Couldn't resolve host ..." 的解决方法(代码片段
有啥方法可以让 curl 连接并让我在输入时输入和发送身体片段?
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途