0
我需要使用vbscript連接到網絡服務器。使用PowerShell這個作品完美無瑕:http-basic-auth針對web服務器與vbs
$url = "https://someserver:9200/?q=name:Hans"
$headers = @{ Authorization = "Basic c29tZXVzZXI6c29tZXBhc3M=" }
$result = Invoke-WebRequest -Uri $url -Method Post -Body $body -ContentType application/x-www-form-urlencoded -Headers $headers
現在我需要做同樣的使用VBScript:
url = "https://someserver:9200/?q=name:Hans"
Set xmlHttp = CreateObject("WinHTTP.WinHTTPRequest.5.1")
xmlHttp.Open "POST", url, false
xmlHttp.SetRequestHeader "Authorization", "Basic c29tZXVzZXI6c29tZXBhc3M="
xmlHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlHttp.send
可悲的是這給了我一個錯誤:
A certificate is required to complete client authentication
我在做什麼錯?
beMoD