網站地址:http://www.godaddy.com/bulk-domain-search.aspx?isc=iapdom799t&ci=8991
我在VB里加了Webbrowser控制元件,進入這個頁面后,通過VB向textarea里填寫好了,但怎么樣都遞交不了。代碼如下:
Web.Document.getElementById("bulkSearchArea").innerText = "abcefge" & Chr(13) & "d"
Web.Document.getElementById("bulkSearchBtn").click
Web是表單中的Webbrowser控制元件。bulkSearchBtn是遞交鏈接的ID。
這個頁面在VB中怎么樣都無法遞交,但直接用IE打開,填寫好表單后單擊GO鏈接可以正常遞交。這幾天都為這個問題搞暈了頭,請大家來幫個忙,看問題出在哪?
uj5u.com熱心網友回復:
我試了一下,Web.Document.getElementById("bulkSearchBtn").click,運行這句后頁面搜索產生了變了化。噢,我加了一段代碼,限制出現新視窗出現。Dim WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1
Private Sub Form_Load()
Set Web_V1 = WebBrowser1.Object
End Sub
Private Sub Web_V1_NewWindow(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Processed As Boolean)
Processed = True
WebBrowser1.Navigate URL
End Sub
uj5u.com熱心網友回復:
樓上的,你這代碼也沒解決我那問題啦。幫忙 再研究一下吧。uj5u.com熱心網友回復:
WebBrowser1.Document.GetElementById("bulkSearchBtn").InvokeMember("click")
uj5u.com熱心網友回復:
Private Sub CommandButton3_Click()
On Error Resume Next
cz = InputBox("比如說baidu", "向textarea里填寫什么?", "baidu")
Set oDoc = CreateObject("htmlfile")
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", "http://www.godaddy.com/bulk-domain-search.aspx?isc=iapdom799t&ci=8991", False
.send
MyCookie = GetCookie(.getAllResponseHeaders)
.Open "POST", "http://www.godaddy.com/domains/actions/dodomainbulksearch.aspx?source=%2fbulk-domain-search.aspx&isc=iapdom799t", False
.SetRequestHeader "Referer", "http://www.godaddy.com/bulk-domain-search.aspx?isc=iapdom799t&ci=8991"
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Connection", "Keep-Alive"
.SetRequestHeader "Cookie", MyCookie
.send "domainNames=" & cz & "&dotTypes=&extrnl=1&bulk=1&redirectTo=customize"
tt = .responsetext
oDoc.body.innerHTML = .responsetext
MsgBox oDoc.forms("dppBulkSearch").all.tags("table")(0).innerText
End With
End Sub
uj5u.com熱心網友回復:
木有權限修改,重發一次:
Private Sub CommandButton3_Click()
On Error Resume Next
cz = InputBox("比如說baidu", "向textarea里填寫什么?", "baidu")
Set oDoc = CreateObject("htmlfile")
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", "http://www.godaddy.com/bulk-domain-search.aspx?isc=iapdom799t&ci=8991", False
.send
MyCookie = GetCookie(.getAllResponseHeaders)
.Open "POST", "http://www.godaddy.com/domains/actions/dodomainbulksearch.aspx?source=%2fbulk-domain-search.aspx&isc=iapdom799t", False
.SetRequestHeader "Referer", "http://www.godaddy.com/bulk-domain-search.aspx?isc=iapdom799t&ci=8991"
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Connection", "Keep-Alive"
.SetRequestHeader "Cookie", MyCookie
.send "domainNames=" & cz & "&dotTypes=&extrnl=1&bulk=1&redirectTo=customize"
tt = .responsetext
oDoc.body.innerHTML = .responsetext
MsgBox oDoc.forms("dppBulkSearch").all.tags("table")(0).innerText
End With
End Sub
Private Function GetCookie(Str$) 'GetCookie(.getAllResponseHeaders)
Dim cookie$, a&, b&, c$, d&, e&, f$
a = InStr(Str, "Set-Cookie: ")
If a = 0 Then
GetCookie = ""
Else
b = InStr(a, Str, ";"): c = Mid(Str, a + 12, b - a - 11)
cookie = c
Do
d = InStr(b, Str, "Set-Cookie: ")
If d = 0 Then Exit Do
e = InStr(d, Str, ";"): f = Mid(Str, d + 12, e - d - 11)
b = e
cookie = cookie & f
Loop
GetCookie = cookie
End If
End Function
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/155891.html
標籤:網絡編程
下一篇:vs2012 熱鍵無法正常注冊
