Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm writing a script that does dynamic DNS updates for me, but my server is behind a router, and so I need to use a web service to determine my public IP.

So far I've found this one which returns just your plain IP. I was looking around trying to find a couple of alternatives to use in my script supposing that that one is down, but I can't find any others that return just the IP as plaintext.

These ones return some HTML, but I really don't want to bother parsing HTML when what the script needs to do is such a simple task.

Does anyone know of some other reliable services which return only your public IP in plaintext?

share|improve this question
add comment

2 Answers 2

up vote 11 down vote accepted

Famous one – I can haz IP:

$ curl icanhazip.com
1.2.3.4

And that's it.

share|improve this answer
    
thanks! - the name is definitely a bonus. –  Alex Coplan May 5 '12 at 16:54
    
True. It's actually the first one I really remember. –  slhck May 5 '12 at 16:56
    
icanhazip.com is not very reliable. Once every few times, the site doesn't answer at all. –  Serge - appTranslator Aug 21 '12 at 14:06
add comment

Or you could host your own. Use a free hosting company, and using PHP use a code like this:

<?php

echo $_SERVER['REMOTE_ADDR'];

?>
share|improve this answer
    
Of course I could do that, but surely there must already be plenty of services out there which do this already. –  Alex Coplan May 5 '12 at 16:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.