成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

vbnet獲取外網(wǎng)ip vbnet網(wǎng)絡(luò)通訊

VB.net 2015 如何獲取外網(wǎng)IP并保存到軟件目錄下的IP.txt文件

Private?Sub?WebBrowser1_DocumentCompleted(ByVal?sender?As?Object,?ByVal?e?As?System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)?Handles?WebBrowser1.DocumentCompleted

成都創(chuàng)新互聯(lián)公司是專業(yè)的淇濱網(wǎng)站建設(shè)公司,淇濱接單;提供成都網(wǎng)站建設(shè)、成都做網(wǎng)站,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行淇濱網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊,希望更多企業(yè)前來合作!

Dim?str?As?String

str?=?Me.WebBrowser1.Document.Body.InnerHtml

Dim?a?As?Integer?=?0

Dim?b?As?Integer?=?0

a?=?InStr(str,?"[")

b?=?InStr(str,?"]")

TextBox1.Text?=?Mid(str,?a?+?1,?b?-?a?-?1)

End?Sub

Private?Sub?Form1_Load(ByVal?sender?As?Object,?ByVal?e?As?System.EventArgs)?Handles?Me.Load

Me.WebBrowser1.Navigate("

)

End?Sub

End?Class

網(wǎng)頁上顯示的有點問題,form1_load 中代碼是:Me.WebBrowser1.Navigate("")

原理:訪問查IP網(wǎng)頁后,獲取網(wǎng)頁上顯示的本機(jī)外網(wǎng)ip地址

VB2013,VB.net 外網(wǎng)IP獲取問題!

直接對服務(wù)器請求。(該服務(wù)器要有相對的功能,連線后控件屬性即包含,可設(shè)置自動回報)

找一個網(wǎng)頁,內(nèi)容含有顯示瀏覽者ip的網(wǎng)址。抓該網(wǎng)頁的內(nèi)容分析獲取外網(wǎng)的字串。

提供一個安全網(wǎng)址給你:

是APNIC亞洲數(shù)據(jù)中心的首頁 的子頁

vb 如何獲取外網(wǎng)ip

vb 如何獲取外網(wǎng)ip代碼:

'獲取公網(wǎng)IP

Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _

ByVal sAgent As String, ByVal lAccessType As Long, _

ByVal sProxyName As String, ByVal sProxyBypass As String, _

ByVal lFlags As Long) As Long

Private Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" ( _

ByVal hInternetSession As Long, ByVal sUrl As String, _

ByVal sHeaders As String, ByVal lHeadersLength As Long, _

ByVal lFlags As Long, ByVal lContext As Long) As Long

Private Declare Function InternetReadFile Lib "wininet.dll" ( _

ByVal hFile As Long, ByVal sBuffer As String, _

ByVal lNumBytesToRead As Long, _

lNumberOfBytesRead As Long) As Integer

Private Declare Function InternetCloseHandle Lib "wininet.dll" ( _

ByVal hInet As Long) As Integer

Private Const INTERNET_FLAG_NO_CACHE_WRITE = H4000000

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Public Function GetSub() As String

Dim wburl$, wburl2$, X1, X2, X3, X4

On Error GoTo err

wburl = ""

wburl = GetUrlFile(wburl)

If InStr(1, wburl, "無法找到該頁") = 0 Then

X1 = InStr(1, wburl, "[")

X2 = InStr(1, wburl, "]")

X1 = Mid(wburl, X1, X2 - X1)

X1 = Replace(X1, "[", "")

X1 = Replace(X1, " ", "")

X1 = Replace(X1, vbCrLf, "")

GetSub = X1

Exit Function

End If

wburl2 = ""

wburl2 = GetUrlFile(wburl2)

If InStr(1, wburl2, "無法找到該頁") = 0 Then

X3 = InStr(1, wburl2, "h2")

X4 = InStr(1, wburl2, "/h2")

X3 = Mid(wburl2, X3, X4 - X3)

X3 = Replace(X3, "h2", "")

X3 = Replace(X3, " ", "")

X3 = Replace(X3, vbCrLf, "")

GetSub = X3

Exit Function

Else

GetSub = "127.0.0.1"

End If

err:

GetSub = "127.0.0.1"

End Function

Private Function GetUrlFile(stUrl As String) As String

Dim lgInternet As Long, lgSession As Long

Dim stBuf As String * 1024

Dim inRes As Integer

Dim lgRet As Long

Dim stTotal As String

stTotal = vbNullString

lgSession = InternetOpen("VBTagEdit", 1, vbNullString, vbNullString, 0)

If lgSession Then

lgInternet = InternetOpenUrl(lgSession, stUrl, vbNullString, _

0, INTERNET_FLAG_NO_CACHE_WRITE, 0)

If lgInternet Then

Do

inRes = InternetReadFile(lgInternet, stBuf, 1024, lgRet)

stTotal = stTotal Mid$(stBuf, 1, lgRet)

Loop While (lgRet 0)

End If

inRes = InternetCloseHandle(lgInternet)

End If

GetUrlFile = stTotal

End Function

使用方法:

在form中調(diào)用GetSub就行了。

List1.AddItem ("公網(wǎng)IP:" GetSub + "..")。

名稱欄目:vbnet獲取外網(wǎng)ip vbnet網(wǎng)絡(luò)通訊
新聞來源:http://jinyejixie.com/article22/dochdjc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、域名注冊、搜索引擎優(yōu)化、用戶體驗、電子商務(wù)、動態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站
高密市| 枣强县| 耿马| 崇州市| 梅州市| 温宿县| 太湖县| 巴林右旗| 防城港市| 辉县市| 宁津县| 天门市| 安丘市| 任丘市| 汨罗市| 霍山县| 二连浩特市| 北宁市| 改则县| 内丘县| 荔浦县| 宁河县| 海阳市| 丰原市| 南陵县| 淮滨县| 固安县| 永济市| 淮南市| 长兴县| 南漳县| 普定县| 华宁县| 家居| 太原市| 九台市| 长岭县| 敦化市| 兰溪市| 静乐县| 五华县|