<?php
$json = file_get_contents('php://input');
$obj = json_decode( $json );
$user_key = 'QOVNog8sFPkN7tZQ1Vo501_TfygtyTdbh_jDjHXKvZeKkOyo7xBcVqdf3gz8TaI6';

$postfields = array("email" => 'loai.123.sh@gmail.com','password'=>'12345678');
$data_json = json_encode($postfields);

	$url1 = "https://api.orderingplus.com/v400/en/tikram/auth";



	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url1);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	  'Content-Type: application/json',
	  'Accept: application/json'
	));
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
	$result = curl_exec($ch);
	$result = json_decode($result);
/*echo "<pre>";
print_r($result);*/
	if(curl_errno($ch)) {
	    echo 'Error:' . curl_error($ch);
	}
	curl_close ($ch);





$response['result'] = $result->result->session->access_token;


header('Content-Type: application/json; charset=utf-8');
header("Access-Control-Allow-Origin: *");
echo json_encode($response);
// return $response;
?>
