Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

send OTP php

<?php
	$otp = rand(1000,9999);
	$phone = "+910123456789"; // target number; includes ISD
	$api_key = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; // API Key
	$req = "https://2factor.in/API/V1/".$api_key."/SMS/".$phone."/".$otp;

	$sms = file_get_contents($req);
	$sms_status = json_decode($sms, true);
	if($sms_status['Status'] !== 'Success') {
		$err['error'] = 'Could not send OTP to '.$phone;
	}
?>
Source by scriptverse.academy #
 
PREVIOUS NEXT
Tagged: #send #OTP #php
ADD COMMENT
Topic
Name
6+1 =