If it helps you could use icingadb-web api to query hosts:
username demo
password demo
https://demo.icinga.com/icingadb/services?service.name~File%2A&format=json
create a filter or not, and copy link address of the export->json
works for hosts services and so on.
and it is machine readable json. just use basic auth on your script.
you can also copy the query url directly and just set the header in your script to
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
with that you wont need &format=json
