Seemingly everyone here has forgotten about the version byte used in addresses!
Create a new address over RPC, decode the base58 into hex, and the first byte will indicate what network you are on.
https://en.bitcoin.it/wiki/List_of_address_prefixes If the item isn't on this list, just follow this procedure with your whatevercoin, and you'll get the address byte.
+1
If your hacking this on PHP, PHPCoinaddress is a good direction to go towards.
https://bitcointalk.org/index.php?topic=200042.0But if you are looking at extracting this info from a daemon, can't see how that can be done without customizing the daemon itself.