Cover Image

PHP IP Fetch

About Fetching an ip address in PHP is rather simple but this relies on the web server, this can be any of the available web servers such as Apache, nginx, lighttpd or even the internal php web server. It shouldn’t really matter what kind of web server you are behind of, unless you have reverse proxying methods or you are behind a VPN/docker/etc… Code Here’s the snippet for the function, I recommend adding this into your helper functions, it shouldn’t really be kept in a class or associative array as you will most probably access it from different sections of code more or less unpredictably....

January 4, 2023 · 3 min · 506 words · Daniel Legt