- You need to know when your ip has changed
- You need to know how to obtain your new ip
- You need a way to send this information to the other server.
Ad. 1. You can run php script as cron job (or similar in windows) to check ip address now with the previous one, which should be stored in some file or local database. If the address changes go to point 3.
Ad. 2. I have checked this in my configuration (web server behind a router with dhcp) and , when I run pages with lynx at my server, the ip provided by ISP is stored in $_SERVER['REMOTE_ADDR'] - you can get it there. I think it won't work with php command line, because it's an apache header, so you have to acces this script via apache from the client located at your server).
Ad 3. You can connect directly to your other server's database and store the new IP.