Yes, it is possible to test a DLR (Delivery Report) for an SMS API server in Laravel localhost. Here are the steps you can follow:
- Create a route in your Laravel application that will receive the DLR webhook. For example:
Route::post('/dlr', function(Request $request) {
// Handle the DLR webhook here
});
-
Use a tool like ngrok to expose your localhost to the internet. This will allow the SMS API server to send the DLR webhook to your localhost. You can download ngrok from https://ngrok.com/download.
-
Start ngrok by running the following command in your terminal:
./ngrok http 80
This will create a public URL that will forward all requests to your localhost.
-
Update the webhook URL in your SMS API server to use the ngrok URL. For example, if your ngrok URL is
https://1234abcd.ngrok.io, then the webhook URL should behttps://1234abcd.ngrok.io/dlr. -
Send an SMS message using the API and wait for the DLR webhook to be triggered. You should see the DLR data in the Laravel application's log or in the response to the API request.
Note: Make sure to secure your DLR webhook route by adding authentication and validation to prevent unauthorized access and ensure the data is valid.