sparqapi/api/application/controllers/Test.php
2022-03-18 11:55:51 +05:30

97 lines
3.1 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
class Test extends REST_Controller {
/**
* load list modal, library and helpers
*/
function __Construct(){
parent::__Construct();
$this->load->helper(array('form', 'url'));
//$this->load->model('test_model');
$this->load->library('asynclibrary');
$this->load->library('aws_rekonition');
}
/**
* @desc : Function to perform multiple task in background
* @param :void
* @return : void
*/
public function ind_get(){
//echo base_url();
print_r(getallheaders());
$url = base_url()."test/sendmail";
$urls = base_url()."test/insert";
$param = array('email' => "jagroop@gmail.com" );
$param1 = array('name' => "Jagroop Singh",
'email' => "jagroop@gmail.com" );
// $async1 = $this->asynclibrary->do_in_background($url, $param);
// $async2 = $this->asynclibrary->do_in_background($urls, $param1);
// print_r($async1);
// print_r($async2);
}
/**
* @desc : Function to send mail
* @param :void
* @return : void
*/
public function sendmail_post(){
// $this->load->library('email');
$user_email = $_POST['email'];
// $message = "Testing";
// $this->email->from('wolfy@gmail.com', 'Wolfy Singh');
// $this->email->to($user_email);
// $this->email->subject("test");
// $this->email->message($message);
// $this->email->send();
$id = $this->db->insert('t_city_master',array('city_name'=> $user_email));
// echo $user_email;
// print_r($id);
}
/**
* @desc : Function to call insert() method
* of test_model to insert data in database
* @param :void
* @return : void
*/
public function insert_post(){
$user_email = $_POST['name'];
$this->db->insert('t_city_master',array('city_name'=>$user_email));
// $email = $this->input->post('email');
// $name = $this->input->post('name');
// $this->test_model->insert($email, $name);
//echo "insert";
}
public function compareFaces_post()
{
//$fk_entity_id = $this->uri->segment(2);//die();
$pdid = $this->post('pdid');
$url1 = $this->post('url1');
$url2 = $this->post('url2');
$data= $this->aws_rekonition->comparePhotos($url1,$url2);
//print_r($data);
$fin_data = array();
foreach($data as $k => $v)
{
$fin_data[$k] = $v;
// echo '***********************';
}
$this->response($fin_data,REST_Controller::HTTP_OK);
}
}