send sms
This commit is contained in:
@@ -139,4 +139,33 @@ abstract class BaseController extends Controller
|
||||
return $password;
|
||||
}
|
||||
|
||||
public function sendSMS($to_number):string{
|
||||
$API_KEY ="TLYsgMTZBeasJHHimcWXG1QPHmjH7FPwnbKwiqTEwGCu6TrK0v13hCn8N6SYZp";
|
||||
$BASE_URL = "https://api.ng.termii.com";
|
||||
$curl = curl_init();
|
||||
$data = array("api_key" => $API_KEY, "to" => $to_number, "from" => "talert",
|
||||
"sms" => "Hi there, testing Termii ", "type" => "plain", "channel" => "generic" );
|
||||
|
||||
$post_data = json_encode($data);
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $BASE_URL."/api/sms/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => $post_data,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
"Content-Type: application/json"
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class Employers extends BaseController
|
||||
|
||||
$sigNatory = $this->pickSignatory($employer_uid);
|
||||
|
||||
$to_number = "16784574345"; // $sigNatory["phone"];
|
||||
|
||||
|
||||
if ($row[0]['uid']!='' && $application_uid !='' ){
|
||||
@@ -79,6 +80,8 @@ class Employers extends BaseController
|
||||
];
|
||||
$addedData = $this->insert_db('employer_checks',$udata);
|
||||
|
||||
$this->sendSMS($to_number);
|
||||
|
||||
$checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($api_data));
|
||||
}else{
|
||||
log_message('error', "Not found API---=>");
|
||||
|
||||
@@ -11,21 +11,35 @@ class Employment extends BaseController
|
||||
$data = $this->request->getPost();
|
||||
$otp_ready = false;
|
||||
$verify_uid = '';
|
||||
$call_return = 0;
|
||||
$status_message = '';
|
||||
|
||||
$row =[];
|
||||
if ( $data['application_uid'] !='' && $data['username'] && $data['password']){
|
||||
$verify_uid = 'ce00b4c9-7a46-4176-aa5a-0f6d83740dbc';
|
||||
|
||||
$sqlLogin = "SELECT * FROM employer_checks WHERE application_uid='".$data['application_uid']."' AND username='".$data['username']."' AND password=md5('".$data['password']."') ";
|
||||
$query = $this->db->query( $sqlLogin );
|
||||
$row = $query->getResult('array');
|
||||
if ( $row[0]){
|
||||
$verify_uid = $row[0]['uid'];
|
||||
$otp_ready = true;
|
||||
$call_return = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
$status_message = "Invalid Username or Password";
|
||||
}
|
||||
}else{
|
||||
|
||||
$status_message = "Missing Required Parameters";
|
||||
$call_return =-1;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'call_return' => '100',
|
||||
'call_return' => $call_return,
|
||||
'verify_uid'=> $verify_uid,
|
||||
'dev_status'=>'FAKE_RESULT_NOT_IMPLIMENTED_FOR_REAL',
|
||||
'status_message'=>$status_message,
|
||||
'otp_ready' => $otp_ready,
|
||||
'records' => $data
|
||||
/* 'row' => $row,
|
||||
'records' => $data*/
|
||||
];
|
||||
return $this->respond($data, 200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user