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.
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.