curl -? transfer a URL
DESCRIPTION
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! curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
1. curl? URL -L? ?###if request page redirected, than redo the request to the new location
2. curl -O URL? ? ?###save response to a local file named as the extracted string from the URL given, if there is no remote file used in given URL, then an error 'Remote file name has no length!' appears. example:
$ curl -O https://baijia.baidu.com/s?id=1595691372942034482&wfr=pc&fr=idx_lst
? ? ? ? ? ? ? ? ? ? ?execution result: filename is 's_id=1595691372942034482'
3. curl --limit-rate 1024(0r xxxx)? URL? ? ###to limit the download rate to xxxx
$ curl --limit-rate 1024 -O http://www.gov.cn/zhengce/content/2017-11/30/content_5243579.htm
? % Total? ? % Received % Xferd? Average Speed? Time? ? Time? ? Time? Current
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dload? Upload? Total? Spent? ? Left? Speed
100 16860? ? 0 16860? ? 0? ? 0? 1035? ? ? 0 --:--:--? 0:00:16 --:--:--? 1227
$ curl -O http://www.gov.cn/zhengce/content/2017-11/30/content_5243579.htm
? % Total? ? % Received % Xferd? Average Speed? Time? ? Time? ? Time? Current Dload? Upload? Total? Spent? ? Left? Speed
? ? ? 100 16860? ? 0 16860? ? 0? ? 0? 98023? ? ? 0? ? ? ? ?--:? ? ? ?--:? ?-- --? ? ?:--? ? ?:--? ? ? ? ? ? --:? ? ? --:? ? --? ? ? ? ? ? ? ? ? ??105k(105*1024)
4. Authentication in curl:? curl -u username:password URL
5. upload file to a ftp: curl -u ftpuser:ftpassword -T "{file1, file2, ..., file-N}"? ftp://ftp.server.test
6. using a proxy to download:? curl -x proxyIp:proxyPort? ?URL
7. Send mail using SMTP:? curl --mail-from mail@test.com --mail-rcpt mail2@test.com smtp://smtpserver.com
8. curl commands in multiple lines, formatting:
? ? ? ? ? ? curl http://www.sitename.com \
? ? ? ? ? ? ? ? ? ? -H "HEADERS......"? \
? ? ? ? ? ? ? ? ? ? -o output.filename \
? ? ? ? ? ? ? ? ? ? ?.? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###Once after typing the message, type '.' to send it immediately.