VB 操作路由器断网连网操作
VB 操作路由器断网连网操作。。。这个谁会啊。。。在线求助了。。。
[解决办法]
Private Sub cd1_Click()
Dim Purl As String
Dim Pmsg As String
'--------以下变量的值是用抓包工具抓的-------------
Pmsg = "GET /userRpm/StatusRpm.htm?Disconnect=断%20线" & " HTTP/1.1" + vbCrLf & "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, */*" + vbCrLf & "Accept-Language: zh-cn" + vbCrLf & "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; TheWorld)" + vbCrLf & "UA-CPU: x86" + vbCrLf & "Accept-Encoding: gzip,deflate" + vbCrLf & "Host: 192.168.1.1" + vbCrLf & "Referer: http://192.168.1.1/userRpm/StatusRpm.htm?Disconnect=断%20线" + vbCrLf & "Authorization: Basic YWRtaW46YWRtaW4=" + vbCrLf & "Connection: Close" + vbCrLf + vbCrLf
'-------------------------------------------------
Purl = "192.168.1.1"
Wk1.Tag = Pmsg
Wk1.Connect Purl, 80
End Sub
Private Sub Form_Unload(Cancel As Integer)
Wk1.Close
End Sub
Private Sub Wk1_Connect()
Wk1.SendData Wk1.Tag
End Sub
Private Sub Wk1_DataArrival(ByVal bytesTotal As Long)
Dim Strdata As String
Wk1.GetData Strdata
'Txtmsg.Text = Strdata
Debug.Print Strdata
End Sub
Private Sub Wk1_Error(ByVal Number As Integer, _
Description As String, _
ByVal Scode As Long, _
ByVal Source As String, _
ByVal HelpFile As String, _
ByVal HelpContext As Long, _
CancelDisplay As Boolean)
MsgBox "Winsock Error number " & Number & vbCrLf & Description
Wk1.Close
End Sub