我尝试使用VBScript将一些数据发布到PHP脚本,但是我做错了......
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open()
objStream.LoadFromFile("base64.txt")
objDocElem.nodeTypedValue = objStream.Read()
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", "http://mysite.com/data.php", False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send "data=" + objDocElem.text
'MsgBox objHTTP.responseText
Set objHTTP = Nothing
Set objStream = Nothing
C:\ Documents and Settings \ User \ Desktop \ data \ test.vbe(3,1) ADODB.Stream:参数类型错误,不可接受 范围,或彼此相容。
答案 0 :(得分:-1)
自己解决了。
Dim TextArea
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set TextFile = oFSO.OpenTextFile("base64.txt", 1)
TextArea = ""
Do Until TextFile.AtEndOfStream
TextArea = TextArea & TextFile.ReadLine & vbNewLine
Loop
TextFile.Close
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", "http://mysite.com/data.php", False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send "data=" + TextArea
Set oFSO = Nothing
Set TextFile = Nothing
Set objHTTP = Nothing