Jump to content
Sign in to follow this  
lequithienan

_StringBetween help me ?

Recommended Posts

lequithienan

This is my code , but i cannot get info country , state , zipcode, areacode , plz help me :)

#include <ie.au3>
#Include <string.au3>

checklocation()

Func checklocation()
$ipaddress = "68.70.24.118"
$oie = _IECreate("http://ip2location.com/" & $ipaddress,0,0)
$html = _IeDocReadHtml($oie)
$country = _StringBetween($html,'<span id="dgLookup__ctl2_lblICountry">','</span></TD>')
$state = _StringBetween($html,'<span id="dgLookup__ctl2_lblIRegion">','</span></TD>')
$city = _StringBetween($html,'<span id="dgLookup__ctl2_lblICity">','</span></TD>')
$zipcode = _StringBetween($html,'<tr><td>ZIP_CODE</td><td> : </td><td>','</td></tr><tr><td>')
$areacode = _StringBetween($html,'<span id="dgLookup__ctl2_lblIAreaCode">','</span></TD>')
Msgbox(0,"",$country & @CRLF & $state & @CRLF & $city & @CRLF & $zipcode & @CRLF & $areacode)

Endfunc

Share this post


Link to post
Share on other sites
Malkey

This appears to work.

#include <ie.au3>
#include <string.au3>

checklocation()

Func checklocation()
    $ipaddress = "68.70.24.118"
    $oie = _IECreate("http://ip2location.com/" & $ipaddress, 0, 0)
    $html = _IEDocReadHTML($oie)
    ;ConsoleWrite($html & @CRLF)
    
    $country = _StringBetween($html, '<SPAN id=dgLookup__ctl2_lblICountry>', '</SPAN')
    $state  = _StringBetween($html, '<SPAN id=dgLookup__ctl2_lblIRegion>', '</SPAN')
    $city   = _StringBetween($html, '<SPAN id=dgLookup__ctl2_lblICity>', '</SPAN')
    $zipcode = _StringBetween($html, '<tr><td>ZIP_CODE</td><td> : </td><td>', '</td></tr>')
    $areacode = _StringBetween($html, '<SPAN id=dgLookup__ctl2_lblIAreaCode>', '</SPAN')
    
    MsgBox(0, "", $country[0] & @CRLF & $state[0] & @CRLF & $city[0] & @CRLF & $zipcode[0] & @CRLF & $areacode[0])

EndFunc ;==>checklocation

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  

×