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

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?


Solution 1:

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:

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:

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

Solution 4:

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:

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