温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

安装CURL

发布时间:2020-07-10 22:44:02 来源:网络 阅读:678 作者:ly_bing 栏目:开发技术

CURL是用于发出网络请求的命令行工具,支持多种协议。也是测试api的利器。

常用功能有:

  1. 查看网页源码:curl www.xxx.xxx

  2. 保存网页:curl -o www.xxx.xxx

  3. 自动跳转:curl -L www.xxx.xxx

  4. 显示头信息:curl -i www.xxx.xxx

  5. 显示通讯过程: curl -v www.xxx.xxx, 或保存更详细的通讯过程到输出文件:curl --trace outout.txt www.xxx.xxx

  6. 发送表单信息:

    1. GET: curl tvbs.cc/form.cgi?data=xxx

    2. POST: curl --data "key=value" tvbs.cc/form.cgi

  7. 文件上传

  8. Referer字段

  9. User Agent字段

  10. Cookie

  11. 增加头信息

  12. Http认证

更多的详细的命令查看:https://curl.haxx.se/docs/httpscripting.html


在linux中的安装命令:

lybing@ubuntu:/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) ...
bing@ubuntu:/usr/local/tutorial$


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI