


<?php
include '../../conn.php';
$numbers=$_GET['phone'];
$email=$_GET['email'];
$noofuser=0;

 $sql ="select * from `doctors` where email='$email' ";
            $result = mysqli_query($con,$sql);
            $noofuser=0;
            while($row = mysqli_fetch_array($result)){
             $noofuser=$noofuser + 1;
			}
			
			
			
if($noofuser == 0){



$otp=$_GET['otp'];
	// Authorisation details.
	$username = "petnvets@gmail.com";
	$hash = "044e4618ff9f90426920ea7f4e57bb3bb7c6f153cee7bedee3db9596f1ff7681";

	// Config variables. Consult http://api.textlocal.in/docs for more info.
	$test = "0";

	// Data for text message. This is the text message data.
	$sender = "PETVET"; // This is who the message appears to be from.
// 	$numbers = "910000000000"; // A single number or a comma-seperated list of numbers
	$message = "Hi, your OTP for PETNVETS is $otp .";
	// 612 chars or less
	// A single number or a comma-seperated list of numbers
	$message = rawurlencode($message);
	$data = "username=".$username."&hash=".$hash."&message=".$message."&sender=".$sender."&numbers=".$numbers."&test=".$test;
	$ch = curl_init('http://api.textlocal.in/send/?');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$result = curl_exec($ch); // This is the result from the API
	curl_close($ch);




	echo $result;
}
else{
  $j->status='102';
  $j->message='Email Already register';
  echo json_encode($j);
}

?>