Skip to content
Advertisement

Responses is empty while calling web services via zend framework 2.3

I am a newbie in zendframework 2.3. In my app i need to call web services. and i used class ZendHttpClient() … everything is fine… but reponse is empty.. It works in curl call via core php

JavaScript

Advertisement

Answer

You could use directly the Http Client by setting the CURLOPT_POST and CURLOP_POSTFIELDS options in the Client and not in the Adapter, just like this :

JavaScript

And then get the response in output (your code is wrong, you should use $response->getBody()) :

JavaScript

Here’s a good post on how to use the Curl Http Adapter in Zf2.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement