외부ip가져오기

VNote 2020.11.27 14:55:25 *: Imports System.Net
Imports System.Text.RegularExpressions

Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Dim ExternalIP As String
ExternalIP = (New WebClient()).DownloadString("http://vnote.kr")
ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")).Matches(ExternalIP)(0).ToString()
Label1.Text = ExternalIP
Catch
Label1.Text = "NOT "
End Try
End Sub
End Class

외부ip지원 주소 입력

 

ExternalIP = (New WebClient()).DownloadString("http://vnote.123a.kr")

        

 

 

   Private Function GetExternalIp() As String

        Try

            Dim ExternalIP As String

            ExternalIP = (New WebClient()).DownloadString("http://time.____.kr/")

            ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _

                         .Matches(ExternalIP)(0).ToString()

            Return ExternalIP

        Catch

            Return Nothing

        End Try

    End Function