The script would have to be on the computer, not the webserver. Since the computers IP may change, the web server would have no clue how to contact the computer to get the updated IP.
What it seems like you need is 2 things.
#1 A program on the computer that connects to your website every so often.
#2 A script that it connects to that will update the webpage that the IP will be stored on.