{"action":"created","issue":{"url":"https://api.github.com/repos/guzzle/guzzle/issues/1963","repository_url":"https://api.github.com/repos/guzzle/guzzle","labels_url":"https://api.github.com/repos/guzzle/guzzle/issues/1963/labels{/name}","comments_url":"https://api.github.com/repos/guzzle/guzzle/issues/1963/comments","events_url":"https://api.github.com/repos/guzzle/guzzle/issues/1963/events","html_url":"https://github.com/guzzle/guzzle/issues/1963","id":277396138,"number":1963,"title":"Unable to parse xml from response","user":{"login":"stojankukrika","id":10199584,"avatar_url":"https://avatars3.githubusercontent.com/u/10199584?v=4","gravatar_id":"","url":"https://api.github.com/users/stojankukrika","html_url":"https://github.com/stojankukrika","followers_url":"https://api.github.com/users/stojankukrika/followers","following_url":"https://api.github.com/users/stojankukrika/following{/other_user}","gists_url":"https://api.github.com/users/stojankukrika/gists{/gist_id}","starred_url":"https://api.github.com/users/stojankukrika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stojankukrika/subscriptions","organizations_url":"https://api.github.com/users/stojankukrika/orgs","repos_url":"https://api.github.com/users/stojankukrika/repos","events_url":"https://api.github.com/users/stojankukrika/events{/privacy}","received_events_url":"https://api.github.com/users/stojankukrika/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-28T14:04:44Z","updated_at":"2017-11-29T06:44:03Z","closed_at":"2017-11-29T06:44:03Z","author_association":"NONE","body":"Hi I get this XML as response:\r\n\r\n    <?xml version=\"1.0\"?>\r\n    <Response>\r\n      <Environment>PRODUCTION</Environment>\r\n      <Method/>\r\n      <ResponseCode>03</ResponseCode>\r\n      <ResponseDescription>Invalid Merchant</ResponseDescription>\r\n      <Fee>0.00</Fee>\r\n    </Response>\r\n\r\nCan someone tell me how do I parse it?\r\n\r\nThat xml I get if print `$response->getBody()->getContents()`\r\n\r\nI try with `simplexml_load_string($response->getBody())` and that gives me an error:\r\n\r\n    \r\n\r\n> simplexml_load_string(): Entity: line 2: parser error : XML\r\n> declaration allowed only at the start of the document\r\n\r\nAlso try with `simplexml_load_string($response->getBody()->getContents())` like this:\r\n\r\n    $xml = simplexml_load_string($response->getBody()->getContents()); if ($xml === false) { echo \"Failed loading XML: \"; foreach(libxml_get_errors() as $error) { echo \"<br>\", $error->message; } } else { print_r($xml); }\r\n\r\nit returns me only `Failed loading XML: without any error`.\r\n\r\nAlso try with `$xml = new SimpleXMLElement($response->getBody());` and get this error: `String could not be parsed as XML`\r\n\r\nCan you tell me what is the problem?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/guzzle/guzzle/issues/comments/347768219","html_url":"https://github.com/guzzle/guzzle/issues/1963#issuecomment-347768219","issue_url":"https://api.github.com/repos/guzzle/guzzle/issues/1963","id":347768219,"user":{"login":"stojankukrika","id":10199584,"avatar_url":"https://avatars3.githubusercontent.com/u/10199584?v=4","gravatar_id":"","url":"https://api.github.com/users/stojankukrika","html_url":"https://github.com/stojankukrika","followers_url":"https://api.github.com/users/stojankukrika/followers","following_url":"https://api.github.com/users/stojankukrika/following{/other_user}","gists_url":"https://api.github.com/users/stojankukrika/gists{/gist_id}","starred_url":"https://api.github.com/users/stojankukrika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stojankukrika/subscriptions","organizations_url":"https://api.github.com/users/stojankukrika/orgs","repos_url":"https://api.github.com/users/stojankukrika/repos","events_url":"https://api.github.com/users/stojankukrika/events{/privacy}","received_events_url":"https://api.github.com/users/stojankukrika/received_events","type":"User","site_admin":false},"created_at":"2017-11-29T06:44:02Z","updated_at":"2017-11-29T06:44:02Z","author_association":"NONE","body":"OK, TNX a lot @alekseykuleshov !"}}
{"actor":{"display_login":"stojankukrika"}}