I'm trying to convert this xml to json or array.

first this is what i did:

$response = simplexml_load_string($xml_test);

and i got error: < not found,
anyone can help me?

HTTP/1.1 200 OK Date: Wed, 03 Jun 2015 10:19:38 GMT Server: Apache-Coyote/1.1 Pragma: no-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/xml;charset=UTF-8 Connection: close  <?xml version="1.0" encoding="UTF-8"?> <serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service" xmlns:com="http://www.webex.com/schemas/2002/06/common" xmlns:meet="http://www.webex.com/schemas/2002/06/service/meeting" xmlns:att="http://www.webex.com/schemas/2002/06/service/attendee"><serv:header>
<serv:response>
<serv:result>SUCCESS</serv:result>
<serv:gsbStatus>PRIMARY</serv:gsbStatus>
</serv:response>

</serv:header>
<serv:body>
<serv:bodyContent xsi:type="meet:createMeetingResponse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<meet:meetingkey>624241744</meet:meetingkey>
<meet:iCalendarURL>
<serv:host>https://apidemoeu.webex.com/apidemoeu/j.php?MTID=m0d5a3c9f3c1b51ab487a3d8177fba783</serv:host>
<serv:attendee>https://apidemoeu.webex.com/apidemoeu/j.php?MTID=mc0cb823f5442d431ed5728351edf909e</serv:attendee>
</meet:iCalendarURL><meet:guestToken>0082aa91a2b0ec3ff8ef644e3ca0a1bc</meet:guestToken>
</serv:bodyContent>
</serv:body>
</serv:message>

If you're including the http header line as part of $xml_test, then I think that's the problem. The first characters simplexml should see should be <?xml, so as soon as it doesn't see '<' as it's first character, it kicks out an error.

This article has been dead for over six months. Start a new discussion instead.