我想在不打开网络浏览器的情况下运行网络流程。我想更新条目,但当我点击按钮我不想打开一个网页。我在c#中做了但我需要在vb6.0中完成
示例:
点击按钮
Uri myUri = new Uri("http://example.com/_change_status.php? id=67&new_status=2")
WebRequest myWebRequest = WebRequest.Create(myUri)
WebResponse myWebResponse = myWebRequest.GetResponse()
答案 0 :(得分:2)
设置对Microsoft XML 6.0
的引用,然后:
Sub webQuery()
Dim strURL As String
Dim strResponse As String
Dim XMLHttpRequest As xmlhttp
strURL = "http://example.com/_change_status.php? id=67&new_status=2"
Set XMLHttpRequest = New MSXML2.xmlhttp
XMLHttpRequest.Open "GET", strURL, False
XMLHttpRequest.setRequestHeader "Content-Type", "text/xml"
XMLHttpRequest.send
strResponse = XMLHttpRequest.responsetext
Set XMLHttpRequest = Nothing
End Sub