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.
You have to separate the params with an ampersand “&” just as you would in a query string parameter
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!