VBScript
私は、要求を送信し、返される応答HTTP POST
を読み取るこの単純なものを持っています。HTML
Function httpPOST(url, body, username, password )
Set Http = CreateObject("Msxml2.ServerXMLHTTP")
Http.Open "POST", url, False, username, password
Http.setRequestHeader _
"Content-Type", _
"application/x-www-form-urlencoded"
Http.send body
pagestatus = Http.status
if pagestatus<> "200" then
httpPOST="Error:"& pagestatus
else
'httpPOST = Http.ResponseBody
'httpPOST = Http.responseText
Set objXMLDoc = CreateObject("MSXML.DOMDocument")
objXMLDoc.async = False
objXMLDoc.validateOnParse = False
objXMLDoc.load(Http.ResponseBody)
Set objNode = objXMLDoc.selectSingleNode("/html/body/center/img")
httpPost = objNode.getAttribute("alt")
end if
End Function
HTML
応答形式は次のとおりです。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>---</title>
</head>
<body>
<center>
<img alt="You are now connected" src="pages/GEN/connected_gen.png">
</center>
</body>
</html>
このスクリプトの問題は、常に返されることですError: Object required: 'objNode'
私は非常に多くのバリエーションのパーサーを試しましたが、オブジェクトXML
に関連する同じエラーが発生するたびに、最終的にあきらめました。XML