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:
dump(file_get_contents('php://input')) check if the post is valid json
make sure your file file.txt is writable
make sure Storage configuration is correct