Wowza Community

Convert XML output to json collection in Laravel 5.4

Hello …

I want to know how I can convert the cURL API XML response to JSON so I can use a foreach loop within my blade page(s).

I use a controller method and do a dd (diedump) on the cURL query. This is the result:

<?xml version="1.0" encoding="UTF-8" ?>\n
<PushPublishStreams serverName="_defaultServer_">\n
  <Version>1502953623962</Version>\n
  <MapEntries>\n
    <EntryName>Leeuwarden</EntryName>\n
    <SessionStatus>NotFound</SessionStatus>\n

etc ..<br><br>Hope someone has experience with this in Laravel and is willing to explain me how to achieve this. All I need for now is the SessionStatus.

Thanks in advance

Hello @Eddie_Elzinga, you can able to receive the json using the Header Accept:application/json, at the common laravel request, something like this:

Http::accept('application/json')->get('http://wonza:8879/v2/server/...');

There a documentation about the Http Client with headers, but I can’t post the link due to limitation of this forum