list ($value, $respcode, $xmlobject) = mshttp_call($msno, $command);
Sends a HTTP REST request to the specified Miniserver and returns the status code and value, and also a SimpleXML object of the full response.
This feature first is available with LoxBerry 1.2.5. Set your LB_MINIMUM version in your plugin.cfg accordingly.
This function is the "raw", generic Miniserver REST function. To send or query data, you should prefer
The first parameter is the Miniserver number (numbers are equal to LBSystem::get_miniservers, starting with 1).
The second parameter is a string with the full command, but without hostname, e.g.
|$msno||x||Number of the Miniserver|
|$command||x||The full command. The parameter must not be URL-encoded.|
Return "value" from Miniserver
|2. return||Status code|
A SimpleXML object of the full data structure returned by the Miniserver
The function returns an array with three values: The queried "value" (string), The status code (string), and the full SimpleXML object.
Use PHP's list function to save the three values to different variables (see example).
Status codes not in the 2xx range (below 200 and from 300 upwards) are an error. Normally, Loxone returns a "code" 200 for ok.
As Loxone Miniserver most commonly returns a HTTP statuscode of "200 OK" in the HTTP header - also with wrong syntax or non-existing elements, the function parses the result and returns the "code", a value the Miniserver returns inside of the response XML.
Therefore, the function may return
- a LoxBerry-own "error code" in the 6xx area (e.g. "601" for "Miniserver not defined")
- the HTTP statuscode, if a real HTTP header errorcode is returned
- the Loxone "code" of the response XML (for errors, most used is the 500)
- 200 if the request was successful
Please consider the difference to LoxBerry::IO::mshttp_call response, as the values need to be accessed different. See the example below.