Getting IP of visitor

Hi,
I am trying to detect the IP of visitors to a website - the overall goal is to display a “Coming Soon” page to all visitors apart from those with specific IP addresses (i.e. the client), who will get to see the full site.
I have added this so far in my header.php snippet:

$ip = $visitor->ip();

But am getting the error Undefined variable: visitor

This is probably something basic but if anyone has any thoughts that would be great. Thank you!

Where are you creating the variable $visitor? Probably you forgot

$visitor = new Visitor();

or

$visitor = kirby()->visitor();

Yep that was it - it’s obviously too hot to think here today! Thanks for your help