Contents that posted a long time ago may be obsolete and may not reflect my current opinion.

OpenDNS has a “un-official” (I didn’t find any docs at least) API for returning your public IP, by a normal DNS query.

dig @resolver1.opendns.com -t A -4 myip.opendns.com +short