1 個回答
- 最新
- 最多得票
- 最多評論
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());
已回答 3 年前
相關內容
- 已提問 4 個月前

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!