Sending POST parameters with Postman doesn't work, but sending GET parameters does

PhpPostman

Php Problem Overview


I'm trying to test a simple PHP page using the Chrome extension Postman. When I send URL parameters, the script works fine (eg the variables are available in the $_REQUEST parameter). When I send them as x-www-form-urlencoded parameters, the $_REQUEST parameter only contains the PHPSESSID.

The script:

<?php
var_export($_REQUEST);
?>

When I send URL parameters, $_REQUEST includes them: URL parameters

But when I send them as POST variables, $_REQUEST doesn't include them: enter image description here

What am I missing?

Php Solutions


Solution 1 - Php

I was setting the url in Postman to be http:// but Apache was redirecting to https:// and somehow the POST variables were being dropped along the way.

After I changed it to https://, the POST variables worked properly.

See also: https://stackoverflow.com/a/28461500/704803

Solution 2 - Php

I faced the same issue in PostMan and Advance REST Client both. I checked through fiddler and found that my request payload is not converted into JSON format.

I am passing my data in Body as x-www-form-urlencoded enter image description here

You can fix it by using Content-Type as application/x-www-form-urlencoded in request header. enter image description here

Solution 3 - Php

Simply use the Body Tab and enter the post parameters there. Note that Body Tab is disabled if Get is selected.

Solution 4 - Php

Check your content-type in the header. I was having issue with this sending raw JSON and my content-type as application/json in the POSTMAN header.

my php was seeing jack all in the request post. It wasn't until i change the content-type to application/x-www-form-urlencoded with the JSON in the RAW textarea and its type as JSON, did my PHP app start to see the post data. not what i expected when deal with raw json but its now working for what i need.

postman POST request

Solution 5 - Php

When you send parameters by x-www-form-urlencoded then you need to set header for the request as using Content-Type as application/x-www-form-urlencoded

Solution 6 - Php

I was having the same problem. To fix it I added the following headers:

Content-Type: application/json

I had to manually add the content type even though I also had the type of "json" in the raw post field parameters.

Solution 7 - Php

Sorry if this is thread Necromancy, but this is still relevant today, especially with how much APIs are used!

An issue I had was: I didn't know that under the 'Key' column you need to put: 'Content-Type'; I thought this was a User Key for when it came back in the request, which it isn't.

So something as simple as that may help you, I think Postman could word that column better, because I didn't even have to read the Documentation when it came to using Fiddler; whereas I did with Postman.

Postman picture

Solution 8 - Php

Instead of using raw JSON body, try using form-data.

Form data request

Solution 9 - Php

For me, the server was expect HTTPS requests, but I didn't specify that in the URL. The hook would reach the server, but the body would be empty.

Solution 10 - Php

> Sometimes Version problem in 'Postman' : > > I have face the same problem. While sending the data using the oldest version of postman.
> That time I have received the empty json data in server side.
> And I have fix this problem, Once I uninstall the oldest version of postman and installed with latest version.

Solution 11 - Php

I was also facing this issue and I just add www in url like -

https://www.your-domain.com/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionwhiterook6View Question on Stackoverflow
Solution 1 - PhpandrewtweberView Answer on Stackoverflow
Solution 2 - PhpArvind DhasmanaView Answer on Stackoverflow
Solution 3 - PhpAndroidLearnerView Answer on Stackoverflow
Solution 4 - PhpmushcraftView Answer on Stackoverflow
Solution 5 - PhpSatish ShindeView Answer on Stackoverflow
Solution 6 - PhpJohn O'ConnorView Answer on Stackoverflow
Solution 7 - PhpLee View Answer on Stackoverflow
Solution 8 - PhpChoxmiView Answer on Stackoverflow
Solution 9 - Phpuser2229618View Answer on Stackoverflow
Solution 10 - PhpMohammed YasinView Answer on Stackoverflow
Solution 11 - PhpNitesh S ChauhanView Answer on Stackoverflow