无法从webhook laravel获得json身体反应

I have been trying to get a json response body when webhook hit on my URL but failing. This is my controller method

public function sendSMS(Request $request){

        $response = json_decode(file_get_contents('php://input'));
        Storage::disk('local')->put('file.txt', Response::json($response));

   }

It always save a empty response in .txt. Can you help me out.

there have lots of reasons you get errors here. I suggest you try debug the following reasons:

  1. dump(file_get_contents('php://input')) check if the post is valid json

  2. make sure your file file.txt is writable

  3. make sure Storage configuration is correct