controller
public function api_input()
{
$data = array(
'user_email' => $this->input->post('user_email'),
'user_pasword' => $this->input->post('user_pasword'),
);
$make_call = $this->callAPI('http://demo.theoneinfotech.com/dating/user/login', json_encode($data));
var_dump($make_call);exit;
$response['result'] = json_decode($make_call, true);
//print_r($response);exit;
/* $errors = $response['response']['errors'];
$data = $response['response']['data'][0];*/
// $this->load->view('user/new',$response);*/
}
function callAPI($url ,$fields){
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields );
$result = curl_exec ( $ch );
curl_close ( $ch );return $result;
}
respose-
string(420) "{"errorCode":0,"message":"User Logged-In Successfully","data":[{"user_id":"36","nick_name":"viveksharma","user_email":"svivek908@gmail.com","user_pasword":"MTIzNDU2","access_token":"c3ZpdmVrOTA4QGdtYWlsLmNvbV9fMTU0NTk4NzIxNQ==","user_verify":"1","user_dob":"0000-00-00","age":"25","user_language":"hindi","user_location":"indore","user_relation":"single","user_invite_code":"","register_date":"2018-12-26 05:41:26"}]}"
In above code api render but response come under the array so how to manage response in html page how to make proper table format of data
Comments
Post a Comment