curl介绍与常见用法

本文主要介绍curl的相关知识及其常见用法。

1. 概述

1.1 what

curl is a command line tool and library for transferring data with URLs.

1.2 What's curl used for

curl is used in command lines or scripts to transfer data. 

curl is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily.

1.3 curl supports

curl supports DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. 

curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling and more.

2. 常见用法

2.1 获取页面

用法:curl URL

示例如下:

curl https://www.baidu.com/
这是curl最简单的使用方法,运行上面的命令可以获取 https://www.baidu.com/ 指向的页面,同样,如果这里的 URL 指向的是一个文件或者一幅图,都可以直接下载到本地。


猜你喜欢

转载自blog.csdn.net/liitdar/article/details/80684730
今日推荐