How to get visitor’s real IP address in CloudFlare enabled website

CloudFlare

CloudFlare

If you are using CloudFlare on your website then you then  $_SERVER[“REMOTE_ADDR”] returns the IP address of cloud flare server instead of visitors IP.Actually CloudFlare works as proxy servers,first it fetches the contents from your hosting server then it delivers to the visitor .But to get get the real ip of visitor you don’t need to worry because it passes the IP address of visitor through a header called   HTTP_CF_CONNECTING_IP.
You can use the following code in PHP to get the real IP address of visitor.