28,391
社区成员
发帖
与我相关
我的任务
分享
Function PostHttpPage(PostUrl,PostData) '获取远程数据 PostUrl为接口 POSTDATE为接口参数及签名requestvalue&sign
Dim xmlHttp
Dim RetStr
Set xmlHttp = CreateObject("Msxml2.ServerXMLHTTP")
xmlHttp.SetTimeOuts 10000, 10000, 15000, 15000 '解析DNS名字10秒 建立Winsock连接10秒 发送数据15秒 接收response15秒
xmlHttp.Open "POST", PostUrl, False '原来为FALSE
XmlHTTP.setRequestHeader "Content-Length", Len(PostData)
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"
Server.CreateObject("Microsoft.XMLHTTP") '就可以了
If Err.Number <> 0 Then
Set xmlHttp=Nothing
PostHttpPage = "$False$"
Response.write "出错出错出错出错出错出错出错不行啊捕捉不到啊啊啊"
Response.end
Exit Function
End If
xmlHttp.Send PostData
PostHttpPage=bytesToBSTR2(xmlHttp.responseBody,"utf-8")
Set xmlHttp = nothing
End Function
<%
PostHttpPage "http://localhost:91/load.asp", "xxxxx"
Function PostHttpPage(PostUrl,PostData)
On Error Resume Next
Dim xmlHttp
Dim RetStr
Set xmlHttp = CreateObject("Msxml2.ServerXMLHTTP")
xmlHttp.SetTimeOuts 10000, 10000, 15000, 15000
xmlHttp.Open "POST", PostUrl, False
XmlHTTP.setRequestHeader "Content-Length", Len(PostData)
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"
xmlHttp.Send PostData
If Err.Number <> 0 Then
Set xmlHttp = Nothing
PostHttpPage = "$False$"
Response.write "出错出错出错出错出错出错出错不行啊捕捉不到啊啊啊" & Err.Description
Response.end
Exit Function
End If
If xmlHttp.status <> 200 Then
Set xmlHttp = Nothing
PostHttpPage = "$False$"
Response.write xmlHttp.status
Response.end
Exit Function
End If
PostHttpPage = bytesToBSTR2(xmlHttp.responseBody,"utf-8")
Set xmlHttp = nothing
End Function
%>