I have a test php code. Which essentially grabs the IP of someone and emails it to an address. I plan later on storing it in a database, but just for testing purposes I have put it as emailing me.
My issue is, I have cloudflare enabled so when I use getenv(REMOTE_ADDR)
it gives me cloudflare's IP rather than the actual visitors IP. Is there a way I can get the visitor's IP?
<?php
$ip = getenv(REMOTE_ADDR);
mail("email@domain.com", "You got a visitor", "IP: ".$ip);
?>