/** * Method to get comments from Instagram media * * @see constructQuery * * @param $shortcode * @param null $cursor_before * @param null $limit * @return array */ public function get($shortcode, $cursor_before = NULL, $limit = NULL) { if (!$cursor_before) { $resultObj = new MediaInfo($this->client); $result = $resultObj->get($shortcode); $this->shortcode = $shortcode; } else { $post_params = $this->constructQuery($shortcode, $cursor_before, $limit); $result = $this->asObject($this->client->webRequest('/query/', 'POST', [], $post_params)); } $media = ['cursor_before' => !empty($result->comments->page_info->start_cursor) ? $result->comments->page_info->start_cursor : NULL, 'data' => !empty($result->comments->nodes) ? $result->comments->nodes : array()]; return $media; }