01-27-2012, 08:15 AM
Another simple source to share.
Screenshot:
Full Codes:
Screenshot:
Full Codes:
Code:
Imports System.Net
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub ButtonGetIP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetIP.Click
TextBoxHostIP.Text = getip(TextBoxHostname.Text)
End Sub
Private Function getip(ByVal hostname As String) As String
Try
Dim postData As String = "url=" & hostname & "&submit=Get+IP"
Dim encoding As New System.Text.UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim host = "http://www.selfseo.com/find_ip_address_of_a_website.php"
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create(host), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = host
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
postReq.ContentLength = byteData.Length
Dim postreqstream As IO.Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
Using postreqreader As New IO.StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
Dim o As Match = Regex.Match(thepage, "The IP address (\S+) is assigned to", _
RegexOptions.IgnoreCase)
If (o.Success) Then
Dim key As String = o.Groups(1).Value
Return key
Else
MsgBox("Error: Please check your hostname.", MsgBoxStyle.Exclamation, "Message")
End If
End Using
Catch ex As Exception
MsgBox("Error: " & ex.Message, MsgBoxStyle.Exclamation, "Message")
End Try
End Function
End Class