请教!!!!!!!!!!!!!1
解决方案 »
- vb中怎么切换系统用户
- 怎样让combox的下拉列表的行 动态换顺序?
- VB如果播放音乐
- access格式问题,在线等待
- 立即结贴:怎样用scripting.filesystemobject对象得到某目录下的所有文件,然后将这些文件删除,请附上源代码
- VBA编程中,能否判断出一幅图象的颜色,图象都是单色图,比如红色和黄色?万分感谢!
- 如何能构把345000这样的秒数转化为像21:00:32这样的字符串???
- Mscomm串行通讯的问题,settings参数设置
- 请大伙看了,发表意见
- 实时错误424 要求对象
- 各位高手,可以帮我看下这道VB程序吗?
- 用VB调用ado操作的时候总是很慢很慢,请问高手如何解决?
再一次感谢!
Dim strResultFileName As String
Dim strHomeUrl As String
Dim strProtocol As String
Dim strPath As String
Dim strRootPath As String
Dim oXmlDoc As New DOMDocument
On Error Resume Next
If InStr(txtRootURL.Text, "//") = 0 Then
MsgBox "URL格式错误," & vbCrLf & "请使用[Protocol]://[Server DNS Name or IP Address]/[Path name]格式", vbCritical
Exit Sub
End If
strProtocol = UCase(Split(txtRootURL.Text, "//")(0))
If strProtocol <> "HTTP:" And strProtocol <> "HTTPS:" Then
MsgBox "协议错误," & vbCrLf & "您只能使用HTTP或HTTPS进行数据上传", vbCritical
Exit Sub
End If
strRootPath = txtRootURL.Text & "/default.asp"
Dim oXmlHttp As New XMLHTTP
Dim oErrorStream As New Stream
' frmLoginWeb.Show vbModal '测试用代码,用于非WebST登录
' oXmlHttp.Open "POST", strRootPath, False '测试用代码,用于非WebST登录
' oXmlHttp.setRequestHeader "Content-Length", Len("user_name=" & frmLoginWeb.mstrUser & "&password=") '测试用代码,用于非WebST登录
' oXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" '测试用代码
' oXmlHttp.send "user_name=" & frmLoginWeb.mstrUser & "&password=" '测试用代码,用于非WebST登录
oXmlHttp.Open "GET", strRootPath, False
'oXmlHttp.Open "GET", strRootPath, False, "dpcjyh", "dpcjyhfml777"
oXmlHttp.send
If Err.Number = 0 Then
strResultFileName = App.Path & "\Error_" & Format(Now(), "YYYYMMDDHHMMSS") & ".htm"
oErrorStream.Type = 1 '以二进制模式打开
oErrorStream.Open
oErrorStream.Write oXmlHttp.responseBody '将字符串内容写入缓冲
oErrorStream.SaveToFile strResultFileName, 2 '-将缓冲的内容写入文件
oErrorStream.Close '关闭对象
If oXmlHttp.Status <> 200 Then
cmdTestURL.Enabled = True
cmdTransmission.Enabled = False
cmdGetProduct.Enabled = False
MsgBox Err.Description, vbCritical
Else
oXmlHttp.Open "POST", txtRootURL.Text & "/store/sell/import_sale_info.asp", False
oXmlHttp.send "<COMMAND NAME='QueryStatus'/>"
If oXmlDoc.loadXML(oXmlHttp.responseXML.xml) Then
cmdTestURL.Enabled = False
txtRootURL.Enabled = False
cmdTransmission.Enabled = True
cmdGetProduct.Enabled = True
MsgBox "连接有效,您现在可以进行数据上传及下载!", vbInformation
Else
MsgBox oXmlHttp.responseText
MsgBox "登录信息不正确!", vbInformation
End If
End If
Else
cmdTestURL.Enabled = True
cmdTransmission.Enabled = False
cmdGetProduct.Enabled = False
MsgBox "连接无效,请检查Internet连接是否有效" & vbCrLf & "或是否有足够的权限访问远程URL", vbCritical
txtUploadURL.SetFocus
End If
Err.Clear
Set oXmlHttp = Nothing
End Sub
一般说用inet,可很多网页,特别是CGI的网页INET会连不上,
XML传输也很好,但遇上有JS脚本的网页就没法了,比如说,网页A,,上有一个JS脚本,,写入COOKIES,。再转到网页B,如果没有它写的COOKIES,你就进不了B,这种用客户端的脚本写入COOKIES,,XML就无法得到B的信息。
还是用webbrowser吧,,安全,又可靠,就是费点时间,
不过我想知道,webbrowser怎么返回源文件,我怎么没找到它的这个属性,请告诉我,
用document.documentElement.outerHTML就能得到它的源文件内容了.