Search
 
SCRIPT & CODE EXAMPLE
 

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;
	}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php constant 
Php :: in laravel date duration validation rule 
Php :: php laravel config 
Php :: artisan make migration with model 
Php :: php compute price less discount 
Php :: action after model is created laravel 
Php :: target class admin homecontroller does not exist laravel 8 
Php :: update php version in laravel 
Php :: date diff in laravel 
Php :: php interface vs abstract class 
Php :: regular expression for strong password in php 
Php :: php array remove keys keep values 
Php :: php calculate days of a month 
Php :: laravel natural sort 
Php :: define site url wordpress 
Php :: wc_product_attribute set_options value 
Php :: wordpress log errors 
Php :: php timestamp to seconds 
Php :: remove last character from string php 
Php :: how to start composer in laravel project on localhost 
Php :: sorting sql query array by column key php 
Php :: laravel invoice number generator 
Php :: model with migration laravel 
Php :: appserviceprovider laravel auth user 
Php :: php remove control characters from string 
Php :: php postgresql 
Php :: laravel download file from s3 
Php :: php strftime datetime 
Php :: php how to connect to db using PDO 
Php :: php-pdo-returning-single-row 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =