Sign in to follow this  
Followers 0
bshellenbaum

WAN/ Router IP

2 posts in this topic

Here's a script scrap that returns the router wan ip by going to a website that returns it in a one line web page. My apologies if this has been done before.

_________________________________________

#include <File.au3>

#include <GUIConstants.au3>

Dim $temp, $wanip , $result1, $file

inetget ("http://checkip.dyndns.org", "c:\waniptemp.txt" , 1,0)

$file= FileOpen("c:\waniptemp.txt",0)

$temp = FileRead( $file,120 )

fileclose($file)

filedelete ("C:\waniptemp.txt")

$result = stringinstr( $temp, "Address:")

$result1 =StringInStr($temp, "</body>")

; above lines find text before and after the IP address in the resultant web page & file

$wanip = stringmid( $temp, $result+8, $result1-($result+8))

msgbox(0,"Wan IP Address", $wanip)

___________________________________________

Share this post


Link to post
Share on other sites



Here's a script scrap that returns the router wan ip by going to a website that returns it in a one line web page. My apologies if this has been done before.

_________________________________________

#include <File.au3>

#include <GUIConstants.au3>

Dim $temp, $wanip , $result1, $file

inetget ("http://checkip.dyndns.org", "c:\waniptemp.txt" , 1,0)

$file= FileOpen("c:\waniptemp.txt",0)

$temp = FileRead( $file,120 )

fileclose($file)

filedelete ("C:\waniptemp.txt")

$result = stringinstr(  $temp, "Address:")

$result1 =StringInStr($temp, "</body>")

; above lines find text before and after the IP address in the resultant web page & file

$wanip = stringmid( $temp, $result+8, $result1-($result+8))

msgbox(0,"Wan IP Address", $wanip)

___________________________________________

<{POST_SNAPBACK}>

It has been done before but it is always good to see different code to achieve the same result. It give people ideas on how to do things differently.. :(

Cheers .. :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0