How to Get IP Address in Codeigniter?
Hi Developer,
In this example, I will show you codeigniter get ip address. I explained simply about codeigniter 4 get ip address. you will learn codeigniter 3 get ip address. you will learn how to get ip address in codeigniter. Alright, let us dive into the details.
If you are work on Codeigniter application and you require to get client ip address then you can get easy. you don't need to use $_SERVER variable like native PHP, but Codeigniter provide $this->input. you can fetch easy using following example:
Example:
$ip = $this->input->ip_address();
print_r($ip);
I hope it can help you...

Hardik Savani
I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- PHP Codeigniter Curl Post Request Example
- Codeigniter Form Validation with Error Message
- Codeigniter - add/remove multiple input fields dynamically with jquery
- Codeigniter Compress Image Size Example
- Stripe Payment Gateway Integration in Codeigniter Example
- Codeigniter 3 - CRUD(Create, Read, Update and Delete) using JQuery Ajax, Bootstrap, Models and MySQL
- Codeigniter 3 - select2 ajax autocomplete from database example with demo
- Codeigniter - How to get current url in controller or view ?
- How to Get IP Address in JQuery?
- How to Get User IP Address in PHP?
- How to Get IP Address in Laravel?
- Which MySQL Datatype use for Store an IP Address?