调用 https 时会出现此问题,但调用 http 时可以正常工作。
我该如何解决这个问题?
完整的工作代码如下:
Option Explicit
On Error Resume Next
Dim strURL, objWinHttp, strResponse
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
objWinHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
'Calling to https fail to retrieve content
strURL= "https://210.5.42.59:8443/sitepreview/http/test2.com/readme.txt"
WScript.Echo strURL
strResponse= CallHTTPTest(strURL)
WScript.Echo strResponse
'Calling to http successfully retrieve content
strURL= "http://ezinearticles.com/?How-To-Clean-a-Car-With-Car-Signs&id=6452594"
WScript.Echo strURL
strResponse= CallHTTPTest(strURL)
WScript.Echo strResponse
Function CallHTTPTest(strURL)
objWinHttp.Open "POST", strURL, false
objWinHttp.Send
objWinHttp.SetTimeouts 5000, 60000, 30000, 420000
objWinHttp.WaitforResponse(440000)
CallHTTPTest= objWinHttp.ResponseText
End Function