Is there a script anyone knows of, or a tutorial of how I can show content based on the users location?

Id like a script that says

if location is UK show this, else show something else

I assume it is possible via IP address, but I wouldn't know where to start. Any advise would be great