WinHttp Post无法检索网站内容

时间:2011-07-27 03:43:57

标签: post web winhttp

调用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

1 个答案:

答案 0 :(得分:0)

我认为您必须协商SSL证书:

Using SSL with WinHTTP