简体   繁体   中英

Unable to get json body response from webhook laravel

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM