I want to set headers like post variable name and the value and send and expect response.
this is also a security question, assume I want to send post a form variables of which are action=”delete” and userid=100, and lets say, I have found a file which accepts ajax requests.
I want to set headers like post variable name and the value and send
Share
curl is your friend! 🙂
Say you’ve noticed an endpoint at
example.org/process.phpthat a form is posting to. You can tailor you own custom request easily from the command line usingcurl.The
--dataor-Dflag lets you pass arbitrary POST data just as an HTML form would. You can also set HTTP request headers with equal ease:You can see exactly what’s happening with the
-v(for verbose) flag. For the first example above the output is:If you’re using a *NIX operating system including Mac OS X, you probably already have
curl, just open a shell. If you work with Ruby at all, I highly recommend curb, a set of bindings for that language. Most PHP installations come with curl support, although the interface is pretty horrible. The docs are over at php.net.