How to get the user browser information in Codeigniter - Stack Of Codes

Breaking

Ads

Monday, 18 December 2017

How to get the user browser information in Codeigniter

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

Topics

PHP (27) CodeIgniter (22) SQL (4) Facebook (3) HTML (3) Blogger (2) Constructor (2) Destructor (2) Google (2) How to (2) Aadhaar (1) Agent (1) Browser (1) CSS (1) Cakephp (1) Constants (1) India (1) Ip address (1) JS (1) Jquery (1) Meta Tags (1) Robots (1) Scraping Data (1) escape_str (1) htaccess (1) iS mobile (1) javascript (1) mysqli (1)