Hello everyone. Currently I am working on a project where I am sending data using postman to my laravel app. I want to use laravel raw while the content type is html or plain text and I want to capture the data in laravel controller. So far, I succeeded using json. But I dont want to use json. Everytime I send data It gets me empty array. I also disabled the csrf token for that route. The code is added below:
//I tried using this but shows empty array
public function getData(Request $request){
$p = $_POST;
dd($p);
}
//I also tried this
public function getData(Request $request){
dd($request->all());
}
Everytime gives me empty array. I tried using html raw like following:
When you post a form, the HTML code that generates that form doesn't get sent to the server. It gets encoded into a query string, so your hidden example would be testing=v1.
In postman, you can do that in the raw field (field1=somedata&field2=somedata). It's the same as a URL query string, but you must make sure you URL encode everything. The easier solution is to select form-data in Postman and just fill in the field names and values. Then it takes care of that part for you.