How do I get raw form data in laravel?

0 votes
I have a script that is trying to send data to my site using HTTP PUT. Normally, I woudl just retrieve it by reading from the input stream with file_get_contents('php://input'). However, when I try that with laravel, I don't get anything! Why not? How do I read the raw input data?
Oct 28 in Laravel by kartik
• 35,300 points
48 views

1 answer to this question.

0 votes

Hii @kartik,

Laravel intercepts all input. If you're using PHP prior to 5.6, the php://input stream can only be read once. This means that you need to get the data from the framework. You can do this by accessing the getContent method on the Request instance, like this:

$content = Request::getContent(); // Using Request facade
     /* or */ 
$content = $request->getContent();

Hope it works!!

answered Oct 28 by Niroj
• 76,540 points

Related Questions In Laravel

0 votes
1 answer

How do I catch exceptions / missing pages in Laravel 5?

Hello @kartik, In Laravel 5 you can catch ...READ MORE

answered Aug 11 in Laravel by Niroj
• 76,540 points
207 views
0 votes
1 answer

How do I get a “select count(*) group by” using laravel eloquent?

Hello @kartik, You could use this: $reserves = DB::table('reserves')->selectRaw('*, ...READ MORE

answered Oct 21 in Laravel by Niroj
• 76,540 points
166 views
0 votes
1 answer

How to get view data during unit testing in Laravel?

Hii, Try this: $response->getSession()->get("errors") And from there you can check ...READ MORE

answered Nov 2 in Laravel by Niroj
• 76,540 points
31 views
0 votes
1 answer

How do I include partials from a blade layout in laravel?

Hello @kartik, You need to give the full ...READ MORE

answered Nov 2 in Laravel by Niroj
• 76,540 points
46 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,540 points
3,434 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,540 points
411 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,540 points
281 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,540 points
4,140 views
0 votes
1 answer

How do I get HTTP Request body content in Laravel?

Hello @kartik, Inside controller inject Request object. So ...READ MORE

answered Aug 11 in Laravel by Niroj
• 76,540 points
936 views
0 votes
1 answer

How to get data from Laravel backend and display in Vue/Nuxt frontend

Hello, You have to use the package dotenv. Then ...READ MORE

answered Apr 8 in Laravel by Niroj
• 76,540 points
954 views