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
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.