
Send OTP using textlocal api in laravel
Send OTP using textlocal api in laravel
In this session, we are going to try to solve the "Send OTP using textlocal api in laravel" puzzle by using the computer language.
Sometimes you have to send the OTP for mobile verification. You can send the OTP using textlocal API in laravel.-
Sample code snippet to send otp using textlocal with get method in laravel
Route::get('/send-otp', function(){ $apiKey = urlencode('Your_api_key'); // Message details $numbers = urlencode('91xxxxxxxxxx'); //Mobile number on which you want to send message $sender = urlencode('SENDER_NAME'); $message = rawurlencode('123456 is OTP for platform verification. Valid for 30 Minutes. Do not Share it with anyone. Contact Us if not initiated by you.'); // Prepare data for POST request $data = 'apikey=' . $apiKey . '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message; // Send the GET request with cURL $ch = curl_init('https://api.textlocal.in/send/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; });
This is the sample code snippet for sending OTP using text local api using GET method in laravel. It’s working in my case. If you find any error please check the message it should be the same as per the DLT template message and text local template, number should have prefix with country code 91.
In case of error please visit - Solution for invalid template error code 80 in textlocal sms API
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- The openssl extension is required for SSL/TLS protection but is not available
- Create project table with model and migration
- Add [name] to fillable property to allow mass assignment on [App\Models\Project]
- Get 30 days older records from table in laravel
- Use of undefined constant laravel
- Get all users except the followings users in overtrue laravel-follow
- How to get column names from table in Laravel
- Send id with route Laravel
- How to get query string value in laravel
- How to check record exist or not in relationship table
- How to get user information using hootlex/laravel-friendships package in laravel
- Get content from web URL in laravel
- Database transactions in laravel
- Laravel 9 route group with controller
- How to include header file in laravel
- InRandomOrder() method with example in laravel
- How to set column as primary key in Laravel model
- How to change default timestamp fields name in Laravel
- Array to string conversion laravel blade
- How to get all route list
- How to validate URL with https using regex in laravel
- Link storage folder in laravel 8
- Laravel 5.4 save data to database
- Insert current date time in a column using Laravel
- Call to undefined method Illuminate\Support\Facades\Request::all()