Sign in to follow this  
Followers 0
Win4lif3

Need help with reading from a website.

3 posts in this topic

#1 ·  Posted (edited)

Problem: i want the ip address's place to be shown just like this: http://whatismyipaddress.com/ip/87.112.32.43 (like it says city: London and State/Region: London... and country: United kingdom..)

and it needs to update when pressing on bottum "New IP" ($update)

please help, i think this can be done somehow with IE.au3 but im not sure how s:

Code:

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$start = 1
If $start = 1 Then $proc = InputBox("Get Ip Addresses from what program?","What Program do you want it to grab Ip addresses from? Example: Skype") & ".exe"
$start = 0
$cmd = "netstat -ano"
$string = _CMDreturn($cmd)
$result = StringSplit($string, @CR)
$list = ProcessList($proc)
$x = 0
$ppid = ProcessExists($proc)
If $list[0][0] = 0 Then
    MsgBox(0, "Error", " The process: " & $proc & " is not running")
    Exit
EndIf
GUICreate("Connected Ip's.",300,300)
$getipsfrom = GUICtrlCreateInput($proc,30,30,240)
$skypepid = GUICtrlCreateInput("Undefined",30,70,240)
$theip = GUICtrlCreateInput("  > > > > Connected Ip's are shown here < < < <",30,100,240,20)
$thecity = GUICtrlCreateInput("City the ip belongs to here",30,130,240,20)
$thestate = GUICtrlCreateInput("State/Region the ip belongs to here",30,160,240,20)
$thecountry = GUICtrlCreateInput("Country the ip belongs to here",30,190,240,20)
$update = GUICtrlCreateButton("Update",30,220,240,20)
$newproc = GUICtrlCreateButton("New Program",30,250,240,20)
GUISetState()
While 1
$msg    =  GuiGetMsg()
If  $msg   =  $GUI_EVENT_CLOSE   Then   ExitLoop
If  $msg   =  -3       Then   Exit
If  $msg    =  $update   Then   begin()
If  $msg    =  $newproc Then   new()
Wend
Func new()
$proc = InputBox("Get Ip Addresses from what program?","What Program do you want it to grab Ip addresses from? Example: Skype") & ".exe"
GUICtrlSetData($skypepid,"Undefined")
GUICtrlSetData($update,"Update")
GUICtrlSetData($theip," > > Connected Ip's are shown here < < ")
GUICtrlSetData($getipsfrom,$proc)
$list = ProcessList($proc)
$x = 0
$ppid = ProcessExists($proc)
EndFunc
Func begin()
GUICtrlSetData($skypepid,"Procces ID: " & $ppid)
GUICtrlSetData($getipsfrom,$proc)
GUICtrlSetData($update,"Next IP")
For $i = 1 To $list[0][0]
  $pid = $list[$i][1]
Next
If $x = $result[0] Then $x = 0
$x = 1+$x
$line = $result[$x]
$newline = StringStripWS($line, 4)
If StringMid($newline, 1, 1) = @LF Then $newline = StringTrimLeft($newline, 1)
$a_line = StringSplit($newline, " ")
If $a_line[0] = 5 Then
  If $a_line[5] = $pid Then
   GUICtrlSetData($theip,$a_line[3])
  ElseIf $x = $result[0] Then
   $x = 0
   $x = 1+$x
   begin()
  Else
   $x = 1+$x
   begin()
  EndIf
ElseIf $x = $result[0] Then
  $x = 0
  $x = 1+$x
  begin()
Else
  $x = 1+$x
  begin()
EndIf
EndFunc
Func _CMDreturn($sCommand)
    $cmdreturn = ""
    $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD)
    While 1
        $line = StdoutRead($stream)
        If @error Then ExitLoop
        $cmdreturn &= $line
    WEnd
    Return $cmdreturn
EndFunc
Edited by Win4lif3

Share this post


Link to post
Share on other sites



you can do it with:

#include <INet.au3>
_INetGetSource ( $s_URL )

and some StringRegExp on the source code you get


Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite

Share this post


Link to post
Share on other sites

you can do it with:

#include <INet.au3>
_INetGetSource ( $s_URL )

and some StringRegExp on the source code you get

i will be trying this tommorow thank you :mellow:

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