Last active
January 19, 2016 10:38
Revisions
-
SendOTP revised this gist
Jan 19, 2016 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,15 @@ class SendOTP { 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); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'application-Key: Your-application-key' )); $result = curl_exec($ch); curl_close($ch); @@ -26,15 +26,15 @@ public function verifyOTP($request) { "oneTimePassword" => $request['otp'] ); $data_string = json_encode($data); $ch = curl_init($this->baseUrl.'/verifyOTP'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'application-Key: Your-application-key' )); $result = curl_exec($ch); curl_close($ch); -
SendOTP revised this gist
Jan 13, 2016 . 1 changed file with 0 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -40,19 +40,5 @@ public function verifyOTP($request) { curl_close($ch); return $result; } } ?> -
SendOTP created this gist
Jan 13, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ <?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); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'application-Key : Your-application-key' )); $result = curl_exec($ch); curl_close($ch); return $result; } public function verifyOTP($request) { $data = array( "countryCode" => $request['countryCode'], "mobileNumber" => $request['mobileNumber'], "oneTimePassword" => $request['otp'] ); $data_string = json_encode($data); $ch = curl_init($this->baseUrl+'/verifyOTP'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'application-Key : Your-application-key' )); $result = curl_exec($ch); curl_close($ch); return $result; } public function checkNumberStatus($request) { $ch = curl_init($this->baseUrl+'/checkNumberStatus?refreshToken='+$request['countryCode']); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'AuthKey : Your-authentication-key' )); $result = curl_exec($ch); curl_close($ch); return $result; } } ?>