Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 19:11
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to get external IP address? [SOLVED]
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 09:15    Post subject:  How to get external IP address? [SOLVED]
Subject description: Get IP address for use in conky
 

This question relates to an old post
http://www.murga-linux.com/puppy/viewtopic.php?p=24927&sid=72e8730e87262e34dcdcca1aa48f6af3

I am trying to pick up my external IP address for conky and found this code on above page

Code:
IPADR=`wget -q "http://ipid.shat.net/iponly" -O - | sed -n 3p`

echo $IPADR


quite helpful for my non-programmer knowledge. However, the result is this:

Quote:
75.112.47.248</title></head>



As I only need the numbers upfront without < and what follows I wonder if anybody has any idea how to change the code to that end?

Very much appreciated

Last edited by wuwei on Mon 03 Jan 2011, 11:09; edited 1 time in total
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9202
Location: Stratford, Ontario

PostPosted: Mon 03 Jan 2011, 10:22    Post subject:  

Code:
IPADR=`wget -q "http://ipid.shat.net/iponly" -O - | sed -n 3p | cut -f 1 -d "<"`
Back to top
View user's profile Send private message 
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 11:07    Post subject: thanks  

Wow
this was fast rcrsn51, and all across the Atlantic.

Best of all....it works like a charm.

Thanks a million.

PS: OS in question is Wary 5.0. This code gives me the external IP. Funny is that Conky in Lupu 519 shows the internal IP when addrs eth0 is entered at the appropriate place in conky.conf. This does not work in Wary. Beats me why, but I am happy with the aforementioned result.
Screenshot attached.
conkywary.jpg
 Description   
 Filesize   149.8 KB
 Viewed   1187 Time(s)

conkywary.jpg

Back to top
View user's profile Send private message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Mon 03 Jan 2011, 12:19    Post subject: Real IP  

Code:
curl whatismyip.org


This gives me my real external IP address. The code from rcrsn51 gives in my case the IP of my ISP proxy server.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9202
Location: Stratford, Ontario

PostPosted: Mon 03 Jan 2011, 12:39    Post subject:  

Using curl is much nicer!
Code:
IPADR=`curl whatismyip.org 2> /dev/null`
Back to top
View user's profile Send private message 
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 14:39    Post subject: external IP address  

@rcrsn51
and
@MagicZaurus

Great, curl works, too.

But why is curl much nicer?
Just a shorter code or does it use less resources? Or what?

Thanks guys.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0484s ][ Queries: 13 (0.0041s) ][ GZIP on ]