curl命令怎么用 curl常用命令及参数详解(8)
curl命令怎么用
curl -F "file=@cooltext.txt" -F "yourname=Daniel"
-F "filedescription=Cool text file with cool text inside"
http://www.post.com/postit.cgi
要在一篇文章中发送两个文件,您可以通过两种方式进行:
使用单个字段名称在单个“字段”中发送多个文件:
curl -F "pictures=@dog.gif,cat.gif" $URL
发送具有两个字段名称的两个字段
curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" $URL
@要在不解释前导or<或嵌入的情况下按字面意思发送字段值;type=,请使用--form-string代替-F。当值是从用户或其他不可预测的来源获得时,建议这样做。在这些情况下,使用-F而不是--form-string可能允许用户欺骗 curl 上传文件。
推荐人
HTTP 请求可以选择包含有关哪个地址将其引用到实际页面的信息。curl 允许您指定要在命令行上使用的引荐来源网址。欺骗或欺骗依赖可用信息或包含某些数据的愚蠢服务器或 CGI 脚本特别有用。
curl -e www.coolsite.com http://www.showme.com/
用户代理
An HTTP request has the option to include information about the browser that generated the request. Curl allows it to be specified on the command line. It is especially useful to fool or trick stupid servers or CGI scripts that only accept certain browsers.
Example:
curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/
Other common strings:
Mozilla/3.0 (Win95; I) - Netscape Version 3 for Windows 95
Mozilla/3.04 (Win95; U) - Netscape Version 3 for Windows 95
Mozilla/2.02 (OS/2; U) - Netscape Version 2 for OS/2
Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav) - Netscape for AIX
Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586) - Netscape for Linux
Note that Internet Explorer tries hard to be compatible in every way:
Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) - MSIE for W95
Mozilla is not the only possible User-Agent name:
Konqueror/1.0 - KDE File Manager desktop client
Lynx/2.7.1 libwww-FM/2.14 - Lynx command line browser
Cookies
Cookies are generally used by web servers to keep state information at the client's side. The server sets cookies by sending a response line in the headers that looks like Set-Cookie: <data> where the data part then typically contains a set of NAME=VALUE pairs (separated by semicolons ; like NAME1=VALUE1; NAME2=VALUE2;). The server can also specify for what path the "cookie" should be used for (by specifying path=value), when the cookie should expire (expire=DATE), for what domain to use it (domain=NAME) and if it should be used on secure connections only (secure).
If you have received a page from a server that contains a header like:
Set-Cookie: sessionid=boo123; path="/foo";
it means the server wants that first pair passed on when we get anything in a path beginning with "/foo".
相关阅读
-
网站推广的基本方法为哪些 网络营销与策划方案
小编为网友们解答网站推广的基本方法为哪些和网络营销与策划方案方面的内容,具体详情如下: 网络世界已变成当代人不可或缺的一种生活习惯,因此,以互联网为基本的商业主题活动也日
-
定制网站建设哪家便宜好做 网页设计制作网站推荐
今天分享:定制网站建设哪家便宜好做和网页设计制作网站推荐方面的内容,接下来就是全面介绍。 网站建设如果能够做得比较好的话,一般能够给其他人留下一个比较深刻的印象,这对于任
-
网站设计制作从哪里学起 html零基础入门教程
你是不是想知道网站设计制作从哪里学起和html零基础入门教程的介绍,请看下面详细的介绍。 网站是很多人都会使用的工具,但是做网站对于大部分人来说就不是件容易的事了,在这里,把学
-
JS怎么判断奇偶数方法代码 javascript判断奇偶数代码及原理详解
javascript判断奇偶数代码 ,以及判断奇偶数的原理分享给各位JS初学者。 代码如下: !DOCTYPE htmlhtmlheadmeta charset="utf-8"meta name="viewport" content="width=device-width, initial-scale=1"title判断奇偶数/title/headb


