35 lines
695 B
PHP
Executable File
35 lines
695 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class KavenegarService
|
|
{
|
|
public function sendVerify(string $mobile, string $token)
|
|
{
|
|
$apiKey = config('kave.api_key');
|
|
|
|
if (!$apiKey) {
|
|
throw new \Exception('KAVE_API_KEY is null');
|
|
}
|
|
|
|
$url = "https://api.kavenegar.com/v1/{$apiKey}/verify/lookup.json";
|
|
|
|
$response = Http::timeout(5)->get($url, [
|
|
'receptor' => $mobile,
|
|
'token' => $token,
|
|
'template' => config('kave.template'),
|
|
]);
|
|
|
|
logger()->info('Kavenegar raw', [
|
|
'url' => $url,
|
|
'status' => $response->status(),
|
|
'body' => $response->body(),
|
|
]);
|
|
|
|
return $response->json();
|
|
}
|
|
|
|
}
|