Как получить json Respone из Guzzle, опубликовать защищенный google-лист

Как получить ответ, когда я отправляю запрос с помощью Guzzle, я использую "guzzle/guzzle": "^3.9",

  $guzzle = new Client(); $postCell = $guzzle ->post('https://sheets.googleapis.com/v4/spreadsheets/' . $spreadsheetId . ':batchUpdate', [], $addProtectedRangeJson ) ->addHeader('Authorization', 'Bearer ' . $arrayAccessTokenClient) ->addHeader('Content-type', 'application/json') ; $postCell ->send() ->getBody(true) ; $contents = (string) $postCell->getBody(); // get body that I post -> my request, not response $contents = $postCell->getBody()->getContents(); // not find getContents, ask me did you mean to call getContentMd5 $answer = json_decode($postCell->getResponse()->getBody(), true); return $answer; 

Теперь $answer :

 result = {Guzzle\Http\EntityBody} [7] readWriteHash = {array} [2] contentEncoding = false rewindFunction = null stream = {resource} resource id='77' type='stream' size = null cache = {array} [9] wrapper_type = "PHP" stream_type = "TEMP" mode = "w+b" unread_bytes = 0 seekable = true uri = "php://temp" is_local = true is_readable = true is_writable = true customData = {array} [1] default = true 

Я пытаюсь $contents = (string) $postCell->getBody(); но мой запрос, а не ответ, но мне нужен ответ

Но в подкреплении говорится о реакции json, где?

Документация Google:

Эти запросы возвращают AddNamedRangeResponse и AddProtectedRangeResponse, содержащие идентификаторы диапазона и свойства. Как это:

 { "spreadsheetId": "1Im64phYYa-7Xv6h_lZSUfzT2WtKuH-aK73pGM6AqnJE", "replies": [ { "addProtectedRange": { "protectedRange": { "requestingUserCanEdit": true, "description": "Protecting total row", "warningOnly": true, "editors": {}, "protectedRangeId": 1608527699, "range": { "endRowIndex": 5, "startRowIndex": 4, "sheetId": 1789894473, "startColumnIndex": 0, "endColumnIndex": 5 } } } } ] } 

Я пробую стандарт:

  $url = 'https://sheets.googleapis.com/v4/spreadsheets/' . $spreadsheetId . ':batchUpdate'; $opts = array('http' => array( 'method' => 'POST', 'header'=>"Content-type: application/json\r\n" . "Authorization: Bearer $arrayAccessTokenClient\r\n", 'content' => $addProtectedRangeJson ) ); // Creating the context for the request $context = stream_context_create($opts); $response = file_get_contents($url, FALSE, $context); $responseData = json_decode($response, TRUE); 

и эта работа отлично, у меня есть ответ google в $responseData

Где найти этот AddProtectedRangeResponse? В google playg ground everythins ok, Ihave resonse, и мне нужен ответ в моем коде. Как получить ответ в жужжание?

Related of "Как получить json Respone из Guzzle, опубликовать защищенный google-лист"