• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

.NET [Función] Obtener IP [vb.net]

Status
Not open for further replies.

fudmario

Leech
User
Joined
Feb 23, 2013
Messages
202
Reputation
0
Reaction score
1,098
Points
143
Credits
0
‎12 Years of Service‎
68%
[LENGUAJE=vb.net]

' Autor : Himanen(Version C#)

'Traducido: fudmario (vb.net)

'Funcion: Obtener IP,mediante la pagina cualesmiip

'Ejemplo de Uso:

'MessageBox.Show(getIP())

[/LENGUAJE]

[LENGUAJE=vb.net]

' Imports System.Net

'Imports System.IO

Public Function getIP()

Try

Dim fr As HttpWebRequest

Dim codehtml As String = String.Empty

Dim targeturi As Uri = New Uri("http://www.cualesmiip.com/")

fr = HttpWebRequest.Create(targeturi)

Dim st As StreamReader = New StreamReader(fr.GetResponse().GetResponseStream)

codehtml = st.ReadToEnd

st.Close()

Dim cad1 As String = "Tu IP real es"

Dim cad2 As String = "("

Dim s As Short

s = codehtml.IndexOf(cad1) + cad1.Length + 1

Return Trim(Mid(codehtml, s, codehtml.Substring(s).IndexOf(cad2) + 1))

Catch ex As Exception

Return "Error"

End Try

End Function

[/LENGUAJE]

 
Status
Not open for further replies.
Back
Top