send otp php

Solutions on MaxInterview for send otp php by the best coders in the world

showing results for - "send otp php"
Ilaria
16 Feb 2018
1<?php
2	$otp = rand(1000,9999);
3	$phone = "+910123456789"; // target number; includes ISD
4	$api_key = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; // API Key
5	$req = "https://2factor.in/API/V1/".$api_key."/SMS/".$phone."/".$otp;
6
7	$sms = file_get_contents($req);
8	$sms_status = json_decode($sms, true);
9	if($sms_status['Status'] !== 'Success') {
10		$err['error'] = 'Could not send OTP to '.$phone;
11	}
12?>