This is The Code
This is How to use itCode:Imports System.Net Imports System.Text.RegularExpressions Function GetExternalIP() As IPAddress Dim lol As WebClient = New WebClient() Dim str As String = lol.DownloadString("http://www.ip-adress.com/") Dim pattern As String = "<h2>My IP address is: (.+)</h2>" Dim matches1 As MatchCollection = Regex.Matches(str, pattern) Dim ip As String = matches1(0).ToString ip = ip.Remove(0, 21) ip = ip.Replace("</h2>", "") ip = ip.Replace(" ", "") Return IPAddress.Parse(ip) End Function
This code is an easy method to get your Ip-address. I've read that sites disclaimer and all the fine print and nothing said I'm not allowed to parse it's html code, although I'm not sure if their is a daily limit or notCode:Dim MyIP As IPAddress = GetExternalIP()
This is my first code bank submission and I hope that it will help someone out
I did a search and didn't find something similar




Reply With Quote
