2 answers
- 210
It's a POST with 2x form fields - username and password.
Just as if you were submitting a form.
There is no XML or JSON wrapping required here.
Add your comment... - 10-1
The below vbscript can work ! Thanks for your advice.
URL1 = "http://192.168.xxx.xxx/open-audit/index.php/login/login_auth"
URL2 = "http://192.168.xxx.xxx/open-audit/index.php/devices"
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.setTimeouts 5000, 5000, 5000, 480000
objHTTP.SetOption 2, 13056
objHTTP.Open "POST", URL1, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send "username=admin&password=password"
Debug.Print objHTTP.responseText
objHTTP.Open "GET", URL2, False
objHTTP.send
Debug.Print objHTTP.responseText
Add your comment...
The Open-AudIT API says:
You can request a cookie by sending a POST to the URL below containing username and password attributes and values:
http:
//
{server}
/open-audit/index
.php
/login/login_auth
is the format XML or JSON ?
XML
<username>admin</username>
<password>password</password>
JSON
{"username": admin, "password": password}
Any ideas/suggestions on how to make the below vbscript work?
Set result = CreateObject("ADODB.Stream")
result.Type = 2
result.Open
result.Position = 0
result.Charset = "UTF-8"
result.WriteText "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbcrlf
result.WriteText "<username>" & "admin" & "</username>" & vbCrLf
result.WriteText "<password>" & "password" & "</password>" & vbCrLf
url = "http://192.168.XX.XX/open-audit/index.php/login/login_auth"
Set objHTTP = WScript.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.setTimeouts 5000, 5000, 5000, 120000
objHTTP.SetOption 2, 13056
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
result.Position = 0
objHTTP.Send "form_systemXML=" + urlEncode(result.ReadText()) + vbCrLf
objHTTP.ResponseText
Please help us to solve the problem.
Thanks for your advice.