By whiterook6


2014-06-11 17:13:43 8 Comments

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?

10 comments

@Lee 2018-09-14 15:03:24

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

@Markus A. Wolf 2018-08-23 07:06:39

Changing from https to https helped me a lot... And it helps me to keep this in mind:

  • POST requests are never cached
  • POST requests do not remain in the browser history
  • POST requests cannot be bookmarked
  • POST requests have no restrictions on data length

@Mohammed Yasin 2017-06-17 08:31:48

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.

@Satish Shinde 2014-06-11 17:42:23

Edit

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

@whiterook6 2014-06-12 20:40:42

Nope, doesn't work.

@uma 2015-10-01 08:44:11

I have same , question .

@Zamrony P. Juhara 2017-03-25 04:37:02

For me was to select Body tab and select x-www-form-urlencoded and below that selection you can find key/value entry where you put your POST key/value data. By the way my Postman version is 4.10.4

@Green 2017-09-06 10:35:08

Postman sets it automatically

@user2229618 2016-09-16 11:24:49

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.

@mushcraft 2014-11-30 16:35:48

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

@Gerard 2015-07-28 13:48:43

Yes, changing the body type to x-www-form-urlencoded fixed it for me

@Cesare 2016-06-25 17:29:48

Yes ^ saved my day

@AndroidLearner 2016-01-11 17:44:06

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

Tutorial with Screenshots.

@JCraine 2018-05-15 23:50:45

Legend! So simple :)

@Arvind Dhasmana 2015-08-12 23:59:27

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

@Rafal Gałka 2015-09-09 18:11:23

Many thanks @Arvind, changing header to application/x-www-form-urlencoded actually works! IMHO, this should be accepted as an answer :)

@Naveed Ahmad 2016-02-06 17:46:47

application/x-www-form-urlencoded fixed my issue, Thanks man

@FirstOne 2016-04-22 02:43:34

Maybe someone is facing the same issue: for me, using localhost/something on POSTMAN wasn't working, but after adding / to the end, php started getting the values from POST and from php://input. I had to use localhost/something/ to make it work.

@Harsh Vardhan Ladha 2016-06-01 01:47:32

Yes! This fixes the issue. Actually, PARAMS field near URL sets the GET data not POST data. And the keyword PARAMS is always being related to GET and DATA being related to POST for passing the data. I think peeps at PostMan should fix this to change automatic, or add the DATA button automatically.

@ismailsunni 2017-09-26 14:11:08

@FirstOne you should at that as an answer. I got the same problem also

@andrewtweber 2015-04-23 04:25:30

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

@Vaviloff 2015-06-18 11:45:27

Cannot thank you enough! This is a trivial mistake that I made, yes, but at the end of the day one sometimes cannot notice all the details.

@anothermh 2015-08-06 19:28:07

This was the issue I had as well. nginx was redirecting via 302 to https and the POST parameters were dropped on the redirect. Manually setting the URL to https:// worked.

@Harsh Vardhan Ladha 2016-06-01 01:39:39

I think this is the bug in Postman. Working for HTTPS and not Working for HTTP. I have seen there code generated by their functinality Generate Code which generated wrong code for Python Requests. querystring = {"username":"data1","mydata":"9232"} payload = "" headers = { 'cache-control': "no-cache", 'postman-token': "aeb70e40-c12a-f713-1d8d-596b8cf976af" } response = requests.request("POST", url, data=payload, headers=headers, params=querystring) print(response.text) I think this is buggy.

@John O'Connor 2015-02-05 23:24:39

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.

Related Questions

Sponsored Content

1 Answered Questions

How I can receive parameter that when I send the message from postman

7 Answered Questions

[SOLVED] How does PHP 'foreach' actually work?

7 Answered Questions

[SOLVED] Sending cookies with postman

  • 2015-06-17 11:34:46
  • MiddleWare
  • 73954 View
  • 42 Score
  • 7 Answer
  • Tags:   cookies postman

3 Answered Questions

[SOLVED] PATCH and PUT Request Does not Working with form-data

1 Answered Questions

1 Answered Questions

[SOLVED] PUT API body missing in Postman / Insomnia

  • 2018-02-22 10:56:55
  • Michael
  • 366 View
  • 1 Score
  • 1 Answer
  • Tags:   php api postman put

1 Answered Questions

[SOLVED] Issue in sending POST data from Postman

  • 2017-08-18 10:43:26
  • Observer
  • 340 View
  • -1 Score
  • 1 Answer
  • Tags:   php html postman

1 Answered Questions

0 Answered Questions

Error in Postman when trying to POST

  • 2016-07-22 13:17:31
  • BennyD
  • 277 View
  • 0 Score
  • 0 Answer
  • Tags:   rest postman

Sponsored Content