I posted the PHP code we use at SkyToaster to check our IPs on GitHub, hope it helps. It can take a little time to run so if you run it on a cron I would test how long it takes first.
@GIANT_CRAB, this actually works on modern versions of PHP.
https://github.com/salscode/rblcheck