Hello,
I am facing problem to get data from API, when I request API URL in local srver (WAMP) it gives error
[User Error] Uncaught Exception: String could not be parsed as XML
and same code on live server (Linux hosting) give a different error
[Warning] SimpleXMLElement::__construct(): Entity: line 1: parser error : Start tag expected, '<' not found
API developer said I am getting a JSON response from the webservice
To get an XML response, please send the HTTP header Content-Type = text/xml
so I modify code like
$service = new RestfulService('my-api-url');
$service->httpHeader('Content-Type: text/xml');
// perform the query
$conn = $service->request();
// parse the XML body
$msgs = $service->getValues($conn->getBody(), "results");
Still I am getting the same errors, is there anything that I am doing wrong?
Thanks in advance