1 Answer
- Newest
- Most votes
- Most comments
2
From what you posted, it appears that the response is, in fact, coming back with contents. The response message body is wrapped in a Stream Object (ref: https://docs.guzzlephp.org/en/stable/psr7.html#streams). To read it, you should be able cast or parse it:
$contents = (string) $result->getBody();
or
$contents_json = json_decode($result->getBody());
answered a year ago
Relevant content
- asked 4 months ago
- asked a year ago
- asked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Thanks for your help. Actually, your solution almost worked but I just had to change the getBody() method with an associative key because this method was not working.
So, the solution was like this: $contents = (string) $result['Body'] OR $contents_json = json_decode($result['Body']);
Ah, right.. the body itself is in an associative array -- nice catch. Glad to hear that it helped get you on your way!