1. 程式人生 > >linux之curl

linux之curl

上傳 using gin color des command index con 網頁

一、官方解讀:

 curl is a tool to transfer data from or to a server, 

using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP).

The command is designed to work without user interaction.

curl offers a busload of (一系列) useful tricks like proxy support, user authen-tication, FTP upload, HTTP post, SSL connections, cookies, file trans- fer resume, Metalink, and more.

As you will see below, the number of features will make your head spin!

  如上內容中重點如下:

  (1)curl是用來傳輸數據到server或從server獲取數據存儲到本地

  (2)其支持的協議包括:DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP

  (3)能夠完成:代理支持、用戶認證、ftp文件上傳、http post、SSL連接、cookies、文件等的傳輸。

 

常用方式:

  (1)獲得頁面內容(百度首頁是頁面,內容會以html返回)

    curl http://www.baidu.com

  (2)獲得頁面內容並以文件形式存儲

    curl -o index.html http://www.baidu.com

  (3)若網頁有重定向,加-L能獲取最終的頁面內容

    curl -L http://www.baidu.com

  (4)若網絡不穩定,加-C能斷點續傳

    curl -c -o cookiec.txt http://www.linux.com

更多用法:

  https://www.cnblogs.com/gbyukg/p/3326825.html

  https://blog.csdn.net/cmzsteven/article/details/73382333

linux之curl