I want to consume a webservice in my phalcon application then I seen the Phalcon's curl http client.
I use it like this :
$provider = CRequest::getProvider();
$provider->setBaseUri('https://example.com/api/');
$provider->header->set('Accept', 'application/xml');
$response = $provider->post('getUsers', [
'myparams' => 'paramsValue',
...
]);
echo $response->body;
But I have a problem when I'm using $response->body
. This will returns me the header and the body at the same time and I can't get the value of my XML.
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 28 Sep 2016 16:14:34 GMT
Content-Type: application/xml
Content-Length: 25
Connection: keep-alive
Status: 200 OK
<id>62</id>
How can I do to get just the XML ?