Using laravel 5.2 I tried the folowing code:
$xml =
"<BALANCE>
<Userid>myuserid</Userid>
<Loginkey>myloginkey</Loginkey>
<Transactionid>mytransactionid</Transactionid>
</BALANCE>";
$request = $client->request('POST', 'serveraddress:serverport/servicename/webservice.php',['Content-Type' => 'text/xml; charset=UTF8'],$xml);
var_dump($request->getBody());
And I get the following response:
object(GuzzleHttp\Psr7\Stream)#171 (7) { ["stream":"GuzzleHttp\Psr7\Stream":private]=> resource(231) of type (stream) ["size":"GuzzleHttp\Psr7\Stream":private]=> NULL ["seekable":"GuzzleHttp\Psr7\Stream":private]=> bool(true) ["readable":"GuzzleHttp\Psr7\Stream":private]=> bool(true) ["writable":"GuzzleHttp\Psr7\Stream":private]=> bool(true) ["uri":"GuzzleHttp\Psr7\Stream":private]=> string(10) "php://temp" ["customMetadata":"GuzzleHttp\Psr7\Stream":private]=> array(0) { } }
According to the provider the request and response on the server are ok.
How can I use the xml response? In other words, how can I use the psr7 object or stream, so I can display meaningfull info?
Answers I read which didn't help me "yet" (either don't know what to do with the info given or the info doesn't apply to my situation);
- https://stackoverflow.com/a/32512634/3664960 -> I'm using 6 and I don't know if the answer sugests going to the older version
- https://stackoverflow.com/a/30549372/3664960 when using the first option to put
string
in front the result is
string(1) " "
- https://stackoverflow.com/a/37258804/3664960 -> json_decode
NULL
string(1) " "
5.https://stackoverflow.com/a/35632231/3664960
See my comments in the comments
What else can I try?
note:
I can read the headers and display them correctly!