0

I use cloudflare for my website and I am wondering why my clients IP changing every time I use this script.

In Google my IP is 5.250.13.100 also in other sites like whatismyip I have same.

But when I use this script in my site(with cloudflare) every time I load this script its give me different IP in same range?

<? 
echo $_SERVER["REMOTE_ADDR"]; 
?> 

IP range is: 173.245.. - 188.114..

By looking in CloudFlare IP ranges I found this range is from CloudFlar!

  • So how can I detect in my website my visitor's real IP?
Prix
  • 19,417
  • 15
  • 73
  • 132
nofaven
  • 3
  • 2

2 Answers2

4
<?php
$realip = $_SERVER['HTTP_CF_CONNECTING_IP'];
?>
Pieter De Clercq
  • 1,951
  • 1
  • 17
  • 29
1

various solutions from cloudflare

From CloudFlare :

To restore the original visitor IP addresses to log files and web applications running on Apache httpd web servers, you will need to install mod_cloudflare

shyammakwana.me
  • 5,562
  • 2
  • 29
  • 50