Cloudflare visitor ip

Welcome!

HTTP_CF_CONNECTING_IP is a custom header sent by Cloudflare to the origin. You can save it to a variable using the global SESSION variable in PHP, like shown below.

You can then save this to a JSON file, a database, or whatever you want to do with it.

$user_ip = $_SERVER["HTTP_CF_CONNECTING_IP"];
6 Likes