Local or private ip

So how can I be sure if my script is not used on a localhost but on a real site? is there a way to check it?