How to get the user browser information in Codeigniter::
//For Ip Address::
$ip_address = $this->input->ip_address();
//For User Agent / Browser::
$this->load->library('user_agent');
if ($this->agent->is_browser())
{
$agent = $this->agent->browser().' '.$this->agent->version();
}elseif ($this->agent->is_robot()){
$agent = $this->agent->robot();
}elseif ($this->agent->is_mobile()){
$agent = $this->agent->mobile();
}else{
$agent = 'Unidentified User Agent';
}
//For Using platform::
$platform = $this->agent->platform();
//For Full Agent String::
$full_user_agent_string = $_SERVER['HTTP_USER_AGENT'];
OR
$full_user_agent_string = $this->agent->agent_string();;
No comments:
Post a Comment