<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://otpwallah.in/api/v1/send/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"mobile" => "9876543210",
"length" => 6
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ak_YOUR_API_KEY",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
?>
use Illuminate\Support\Facades\Http;
$response = Http::withToken('ak_YOUR_API_KEY')
->post('https://otpwallah.in/api/v1/send/sms', [
'mobile' => '9876543210',
'length' => 6,
]);
if ($response->successful()) {
$result = $response->json();
}
const axios = require('axios');
axios.post('https://otpwallah.in/api/v1/send/sms', {
mobile: '9876543210',
length: 6
}, {
headers: {
'Authorization': 'Bearer ak_YOUR_API_KEY',
'Content-Type': 'application/json'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));