Posté le 18 novembre 2014 - 13:40 |
Procedure WS_GeoIpLatitudeLongitude(LOCAL IP, LOCAL DebugSn)
ok is boolean = False
Url is string = "http://www.geoiptool.com/pt/"+ IP
Inicio, Fim is int = 0
sXml, Latitude, Longitude, Busca, sBuscaTD is string = ""
HTTPTimeOut(GloHTTPTimeOut)
ok = HTTPRequest(Url)
IF ok = True THEN
sXml = HTTPGetResult(httpResult)
sXml = Replace(sXml,"Matriz,","") sXml = Replace(sXml,"Matriz","")
IF Length(sXml) > 0 THEN
Busca = "Longitude:"
Inicio = PositionOccurrence(sXml,Busca,firstRank)
Busca = "Latitude:"
Fim = PositionOccurrence(sXml,Busca,firstRank) + 100
sXml = Middle(sXml,Inicio, Fim-Inicio)
sXml = Replace(sXml, " ", "")
sXml = Replace(sXml, "<10>", "")
sXml = Replace(sXml, "<br>", "")
sXml = Replace(sXml, Charact(13), "")
sXml = Replace(sXml, Charact(10), "")
sXml = Replace(sXml, Charact(34), "")
sXml = Replace(sXml, Charact(13)+Charact(10), "")
sXml = Replace(sXml, "</span></td><tdalign=leftclass=arial_bold>", "")
sXml = Replace(sXml, "</td></tr><tr><tdalign=right><spanclass=arial>", "; ")
sXml = Replace(sXml, "</td>", "")
Inicio = PositionOccurrence(sXml,"Latitude:",firstRank,IgnoreCase)
Longitude = Middle(sXml,11,Inicio-13)
Latitude = Middle(sXml,Inicio+9,Length(sXml))
GloVoceLatitude = Latitude
GloVoceLongitude = Longitude
sXml = Latitude +"; "+ Longitude
IF DebugSn = "S" fSaveText("c:\latlong.txt",sXml) END
END
END
RESULT(sXml) |
| |
| |
|