curl命令怎么用 curl常用命令及参数详解(9)
curl命令怎么用
Example, get a page that wants my name passed in a cookie:
curl -b "name=Daniel" www.sillypage.com
Curl also has the ability to use previously received cookies in following sessions. If you get cookies from a server and store them in a file in a manner similar to:
curl --dump-header headers www.example.com
... you can then in a second connect to that (or another) site, use the cookies from the 'headers' file like:
curl -b headers www.example.com
While saving headers to a file is a working way to store cookies, it is however error-prone and not the preferred way to do this. Instead, make curl save the incoming cookies using the well-known Netscape cookie format like this:
curl -c cookies.txt www.example.com
Note that by specifying -b you enable the "cookie awareness" and with -L you can make curl follow a location: (which often is used in combination with cookies). So that if a site sends cookies and a location, you can use a non-existing file to trigger the cookie awareness like:
curl -L -b empty.txt www.example.com
The file to read cookies from must be formatted using plain HTTP headers OR as Netscape's cookie file. Curl will determine what kind it is based on the file contents. In the above command, curl will parse the header and store the cookies received from www.example.com. curl will send to the server the stored cookies which match the request as it follows the location. The file "empty.txt" may be a nonexistent file.
To read and write cookies from a Netscape cookie file, you can set both -b and -c to use the same file:
curl -b cookies.txt -c cookies.txt www.example.com
Progress Meter
The progress meter exists to show a user that something actually is happening. The different fields in the output have the following meaning:
% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed
0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287
From left-to-right:
% - percentage completed of the whole transfer
Total - total size of the whole expected transfer
% - percentage completed of the download
Received - currently downloaded amount of bytes
% - percentage completed of the upload
Xferd - currently uploaded amount of bytes
Average Speed Dload - the average transfer speed of the download
Average Speed Upload - the average transfer speed of the upload
Time Total - expected time to complete the operation
Time Current - time passed since the invoke
Time Left - expected time left to completion
Curr.Speed - the average transfer speed the last 5 seconds (the first 5 seconds of a transfer is based on less time of course.)
相关阅读
-
网站推广的基本方法为哪些 网络营销与策划方案
小编为网友们解答网站推广的基本方法为哪些和网络营销与策划方案方面的内容,具体详情如下: 网络世界已变成当代人不可或缺的一种生活习惯,因此,以互联网为基本的商业主题活动也日
-
定制网站建设哪家便宜好做 网页设计制作网站推荐
今天分享:定制网站建设哪家便宜好做和网页设计制作网站推荐方面的内容,接下来就是全面介绍。 网站建设如果能够做得比较好的话,一般能够给其他人留下一个比较深刻的印象,这对于任
-
网站设计制作从哪里学起 html零基础入门教程
你是不是想知道网站设计制作从哪里学起和html零基础入门教程的介绍,请看下面详细的介绍。 网站是很多人都会使用的工具,但是做网站对于大部分人来说就不是件容易的事了,在这里,把学
-
JS怎么判断奇偶数方法代码 javascript判断奇偶数代码及原理详解
javascript判断奇偶数代码 ,以及判断奇偶数的原理分享给各位JS初学者。 代码如下: !DOCTYPE htmlhtmlheadmeta charset="utf-8"meta name="viewport" content="width=device-width, initial-scale=1"title判断奇偶数/title/headb


