栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Wget发布请求?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Wget发布请求?

Wget当前仅支持x-www-form-urlenpred数据。

--post-file
不是用于将文件作为表单附件传输,而是需要格式为的数据
key=value&otherkey=example

--post-data
--post-file
以相同的方式工作:唯一的不同是,
--post-data
您可以在命令行中指定数据,而
--post-file
允许您指定包含要发送的数据的文件的路径。

这里是文档:

 --post-data=string       --post-file=fileUse POST as the method for all HTTP requests and send the specified datain the request body.  --post-data sends string as data, whereas--post-file sends the contents of file.  Other than that, they work inexactly the same way. In particular, they both expect content of theform "key1=value1&key2=value2", with percent-encoding for specialcharacters; the only difference is that one expects its content as acommand-line parameter and the other accepts its content from a file. Inparticular, --post-file is not for transmitting files as formattachments: those must appear as "key=value" data (with appropriatepercent-coding) just like everything else. Wget does not currentlysupport "multipart/form-data" for transmitting POST data; only"application/x-www-form-urlenpred". only one of --post-data and--post-file should be specified.

关于身份验证令牌,应该在标头,URL路径或数据本身中提供它。必须在您使用的服务的文档中的某处指出。在POST请求中,就像在GET请求中一样,您必须使用键和值指定数据。这样,服务器将能够接收具有特定名称的多个信息。变量也是如此。

因此,您不仅可以将魔术令牌发送到服务器,还需要指定密钥的名称。如果密钥是“令牌”,则应该是

token=YOUR_TOKEN

wget --post-data 'user=foo&password=bar' http://example.com/auth.php

另外,如果可以的话,应该考虑使用curl,因为使用它可以更轻松地发送文件。互联网上有很多例子。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/386505.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号