I was having fits getting the REST Client for Firefox to let me create a post body where PHP would recognize the parameters I was trying to post. I added them to the “request body” but my REST server wasn’t showing that I was even posting anything.
I found out that you have to set the “request header” section of the Firefox plugin to have a “name” = “Content-Type” and “value” = “application/x-www-form-urlencoded”. Then I was able to put something like “name=themayesfamily” in the “request body” and my server found a post variable with called “name” with the value I’d set.
Hope this helps some others.
Thanks this really helped
Thank you. I knew I had to put a header in but wasn’t sure if it was one line or a bunch of lines. Glad this cleared it up!
I was struggling setting up post content with RESTClient for a while. This was the number one post in my Google search and answered my question perfectly. Thanks
Hi,
Firstly cheers for your post. It has been a great help. Does anyone know how to separate multiple Post parameters?
I entered this in my request body: key1=value1;key2=value2 …
Unfortunately I end up with only one POST paraemter key1 in php, which contains value1;key2=value2 as value.
Use & instead
key1=value1&key2=value2 …
You have to separate the params with an ampersand “&” just as you would in a query string parameter
Posting multiple values by separating the key value pair with an “&”, e.g., key1=value1&key2=value2 … worked for me.
That said, I need help getting post to work with JSON? I’ve set the header to Content-Type: application/json, but any valid JSON typed into the body always results in any empty PHP $_POST?
Tobias Wittur!
This is a super late response, but the correct way to separate multiple POST parameters is the same as it works in URLs using the ampersand ‘&’ to separate the values. Example : key1=value1&key2=valu2&key3=value3. Remember to specify ‘application/x-www-form-urlencoded’ under Body/Content Headers/Content-Type.
Cheers!
Nice info but what if I need authentication by specifying username and password and at the same time I put JSON code in the body? I cannot put POST fields in the body ’cause the JSON would result malformed.
Thanks!
good! this really helps me !!! thanks!!!
Nice! Tnx
Thank you for this!
Helped me think of how I might be able to use “POSTMAN” (Chrome plugin for making requests) with phonenumbers (starting with +) as values for parameters. 🙂
Thank you for sharing! 🙂