WinHttp Post fail to retrieve website content
This issue happen when calling to https, but works fine when call to http.
How can I resolve this?
Full working code at below:
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-开发者_如何学CSigns&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
I think you will have to negotiate the SSL certificates:
Using SSL with WinHTTP
精彩评论