简体   繁体   中英

Http Request Methods, and Parameters

well, out of curiosity, what are the HTTP methods that accept parameters in the query string? they all? which HTTP methods in which the parameters have to be sent via cURL POSTFIELDS?

All request methods ( GET , HEAD , POST , OPTIONS , PUT , TRACE , DELETE , BREW ) may have GET-style ?x=y request parameters. It's just very uncommon for some others ( CONNECT ).

The reason is that HTTP deals with "resources", and it doesn't actually care about URL parameters. Starting from the / path delimiter it's all just considered a resource name. Whether there are any ? question marks in it, or the receiving webserver uses @ in its place is irrelevant, because implementation-specific.

HTTP clients obviously know about URL schemes and how to split them up, but it's not a big concern for the protocol itself. I think the specification ( RFC1616 ) makes little mention besides the URL scheme description. HTTPbis might be more elaborate.

If you have a POST-style request body with other methods actually depends less on the HTTP verb, but on the presence of a Content-Type: and Content-Length: request header.

In the query string eg (http://www.mydomain.com/myscript.php?myParameter=myValue) is known as a GET method and the other method which sends data behind the scenes is POST. You can in fact use both GET and POST at the same time. If you are uploading files you are required to send it in POST with a enctype of "multipart/form-data"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM