I know there are many tell-your-IP-address services available, some even have the whois lookup functionality. I found it was unhelpful when it comes to scripting. I made a website, it has more features which curlmyip.com doesn’t have. It could report your IP address for a script-friendly way (direct response). It supports ipv4, ipv6 and SSL access.
IP:
http://ipv4.luxing.im
http://ipv6.luxing.im
http://ip.luxing.im
https://get.luxing.im/ip
User-Agent:
http://ua.luxing.im
https://ua.luxing.im
http://get.luxing.im/ua
When you are using the ua.luxing.im method in cURL, you need to add -L option to follow the link.
If you are using cURL with SSL, you may need to take a look at this article.