1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Function GetComputerName(strSerial)
'On Error Resume Next
Dim strURL
strURL = "http://xxxx.xxx.xxxx:16001/u_workstation.do?XML&sysparm_action=getRecords&sysparm_query=serial_number="+strSerial+"&displayvariables=false"
'Create XMLHTTP/ServerXMLHTTP/WinHttprequest object
'You can use any of these three objects.
Set http = CreateObject("MSXML2.XMLHTTP")
'Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
'Open URL As POST request
http.Open "POST", strURL, False
http.setRequestHeader "Content-Type", "application/xml"
'Send the form data To URL As POST binary request
'http.send "serial_number=" + strSerial
http.send
'Get a result of the script which has received upload
'GetComputerName = http.responseText
Dim XmlDoc2
Set XmlDoc2 = CreateObject("Msxml2.DOMDocument")
XmlDoc2.async = false
If xmlDoc2.loadXML(http.responseText) Then
Dim ElemList 'as new XmlDoc.SelectSingleNode("xmlNode")
Set ElemList = XmlDoc2.SelectSingleNode("xml/u_workstation/name")
GetComputerName = ElemList.Text
Else
GetComputerName = "null"
End If
End Function |
Partager