共计 903 个字符,预计需要花费 3 分钟才能阅读完成。
-X, –request <command>
- curl 默认的 http 申请办法是 GET。
- 通常状况下,你并不需要指定这个选项,他会通过其余命令推导进去。
- 应用这个选项来指定 http 的申请办法,其实没卵用,他并不会扭转 curl 命令的理论行为,你指定了 GET,它并不一定应用 GET 办法发送申请。
今天上代码。
- (HTTP) Specifies a custom request method to use when communicating with the HTTP server.
- The specified request will be used instead of the method otherwise used (which defaults to GET).
- Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more.
- Normally you don’t need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.
- This option only changes the actual word used in the HTTP request, it does not alter the way curl behaves. So for example if you want to make a proper HEAD request, using -X HEAD will not suffice. You need to use the -I, –head option.
- (FTP) Specifies a custom FTP command to use instead of LIST when doing file lists with FTP.
- If this option is used several times, the last one will be used.
正文完