This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="jquery-2.1.4.min.js"></script> | |
<script type="text/javascript"> | |
function sendOTP() { | |
var data = {"countryCode": "country code", "mobileNumber": "Mobile number to be verified"}; | |
$.ajax({ | |
url: 'http://Your-domain-name/path/sendotp.php?action=generateOTP', | |
type: 'POST', | |
dataType: 'json', | |
data: data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SendOTP { | |
private $baseUrl = "http://sendotp.msg91.com/api"; | |
public function generateOTP($request) { | |
$data = array("countryCode" => $request['countryCode'], "mobileNumber" => $request['mobileNumber']); | |
$data_string = json_encode($data); | |
$ch = curl_init($this->baseUrl.'/generateOTP'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import org.json.JSONObject; | |
import javax.ws.rs.core.MediaType; | |
import java.util.HashMap; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This code is based on jersey-client library. | |
* For gradle based project use compile 'com.sun.jersey:jersey-client:1.18.4' | |
* You can also download the jar and add it to you project. | |
* */ | |
public class SendOTPBasic { | |
//Base URL | |
public static String baseUrl = "http://sendotp.msg91.com/api"; | |
// Your application key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SendOTPBasic { | |
private $baseUrl = "http://sendotp.msg91.com/api"; | |
public function checkNumberStatus($request) { | |
$ch = curl_init($this->baseUrl+'/checkNumberStatus?refreshToken={REFRESH TOKEN}&countryCode={91}&mobileNumber={98XXXXX}'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_AUTOREFERER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
class SendOTP { | |
private $baseUrl = "https://sendotp.msg91.com/api"; | |
public function callGenerateAPI($request) { | |
$data = array("countryCode" => $request['countryCode'], "mobileNumber" => $request['mobileNumber'],"getGeneratedOTP" => true); | |
$data_string = json_encode($data); | |
$ch = curl_init($this->baseUrl.'/generateOTP'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import org.json.JSONObject; | |
import javax.ws.rs.core.MediaType; | |
import java.util.HashMap; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="jquery-2.1.4.min.js"></script> | |
<script type="text/javascript"> | |
function sendOTP() { | |
var data = JSON.stringify({countryCode: "country code", mobileNumber: "Mobile number to be verified"}); | |
$.ajax({ | |
url: 'https://sendotp.msg91.com/api/generateOTP', | |
type: 'POST', | |
crossDomain: true, | |
processData: false, | |
contentType: 'application/json', |