What's an easy way to test sending POST requests when making a website? I can easily send GET requests by typing it in the URL (example.com/?foo=开发者_Go百科bar&bar=baz
) but what's an equivalently easy way to send POST requests?
Curl CLI
curl -d "param1=value¶m2=value2" http://www.example.com/resource
or
curl -F "fileupload=@filename.txt" http://www.example.com/resource
https://superuser.com/questions/149329/how-do-i-make-a-post-request-with-curl/149335#149335
But I always just use a test script with a http request class. I find you get finer granularity over headers, formats, verb, etc. And of course you can put that code into a unit test after you're done. I use this class that I wrote ( https://github.com/homer6/altumo/blob/master/source/php/Http/OutgoingHttpRequest.md ) but I hear that the zend request class is quite good too.
You can use Fiddler or a Browser plugin like FireFox Tamper Data.
Or you can just create a form and submit it from any .HTML page:
<form action="TestPage.html" method="POST">
<input name="name1" value="value1" />
<input name="name2" value="value2" />
<input type="submit" value="POST!" />
</form>
you can use any inspector to do that like fireFox
make request type post >> put your url >> put parameters in request body section
try some http request sending tools like Wfetch
Postman in Google Chrome, is a great tool to test POST methods.
精彩评论