xml - VB.net Get text/string from html element -
i'm having major trouble trying bits of elements , returning strings. have few exmaples of trying strings , not failing hard.
html phrasing difficult me appreciated.
explantion of need:
i need strinsg of different elements off site when entering ip http://www.ip-tracker.org/
i need pretty details labels or text boxes.
or xml phrasing http://ip-api.com/xml/8.8.8.8
so here exmaple i've used far haven't got far it.
exmaple 1:
dim client new webclient dim ip string dim city string dim region string private function getip() try dim page string = client.downloadstring("http://www.ip-tracker.org/locator/ip-lookup.php?ip=82.16.38.43/") ip = page.substring(page.indexof("ip address:") + 80) ip = ip.substring(0, city.indexof(" </td") + 30) textbox2.text = ("ip address: " + ip) catch ex exception city = "unable lookup" end try return 0 end function
to call it:
getviews()
try xml linq
imports system.xml imports system.xml.linq module module1 dim url string = "http://ip-api.com/xml/8.8.8.8" sub main() dim query xelement = xelement.load(url) dim status string = query.element("status").value dim country string = query.element("country").value dim region string = query.element("region").value dim regionname string = query.element("region").value dim city string = query.element("city").value dim zip string = query.element("zip").value dim lat double = query.element("lat").value dim lon double = query.element("lon").value dim timezone string = query.element("timezone").value dim isp string = query.element("isp").value dim org string = query.element("org").value dim _as string = query.element("as").value dim subquery string = query.element("query").value end sub end module