Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Get your IP address
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gatorparrots" data-source="post: 18719"><p>Lately, I've been using this code to obtain my external IP address:</p><p>[code]curl -s [url]http://www.showmyip.com/simple/[/url] | awk '{print $1}'[/code]</p><p></p><p>However, if you have a Linksys BEFSR-series router, the following code is better for scripting purposes, as it obtains results in about half the time:</p><p>[code]</p><p>/usr/bin/curl --connect-timeout 5 -s \</p><p> http://:$PASSWORD@$ROUTERIP/Status.htm | \</p><p> sed -e 's/^.*IP Address://' | \</p><p> sed -e 's/=2>/\\</p><p>/' | \</p><p> sed -e '1 d' | \</p><p> sed -e 's/<.*//'[/code]</p></blockquote><p></p>
[QUOTE="gatorparrots, post: 18719"] Lately, I've been using this code to obtain my external IP address: [code]curl -s [url]http://www.showmyip.com/simple/[/url] | awk '{print $1}'[/code] However, if you have a Linksys BEFSR-series router, the following code is better for scripting purposes, as it obtains results in about half the time: [code] /usr/bin/curl --connect-timeout 5 -s \ http://:$PASSWORD@$ROUTERIP/Status.htm | \ sed -e 's/^.*IP Address://' | \ sed -e 's/=2>/\\ /' | \ sed -e '1 d' | \ sed -e 's/<.*//'[/code] [/QUOTE]
Verification
Name this item 🌈
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Get your IP address
Top