Send OTP sms with textlocal api

$apiKey = urlencode($YOUR_API_KEY);	
	// Message details
	$numbers = array($mobile);
	$sender = urlencode($SENDER_ID);
	$message = rawurlencode($SENDER_MESSAGE);
	$numbers = implode(',', $numbers);
	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
	// Send the POST request with cURL
	$ch = curl_init('https://api.textlocal.in/send/');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);
	
	// Process your response here
	$response=json_decode($response, true);
	return $response['status'];
© 2016 - 2022, All Rights are Reserved.