我有事情,似乎工作。重要的是位於底部,我採取nextLink
並使用這些部分來創建一個新的查詢。這並不理想,但它比嘗試手動捲曲的東西更好,因爲網上的所有內容似乎都暗示了這一點。當然,Google_Service_Analytics_GaData
將根據正在使用的服務而變化。
do {
$rows = $results->getRows();
foreach ($rows as $row) {
$record = array();
foreach ($row as $i => $field) {
$name = $headers[$i]->name;
switch($headers[$i]->dataType) {
case 'FLOAT':
$record[$name] = (float) $field;
break;
case 'INTEGER':
$record[$name] = (int) $field;
break;
default:
$record[$name] = (string) $field;
}
}
$records[] = $record;
};
$nextLink = $results->getNextLink();
if ($nextLink) {
/* The GA API doesn't have anything to actually USE The link
* they so helpfully supply, so we have to disassemble it and
* make a new query off of it. Internally,
* $this->gaService->data_ga calls $this->gaService->call.
* These are on `Google_Service_Analytics_DataGa_Resource` and
* `Google_Service_Resource`, respectively.
*/
$options = [];
parse_str(substr($nextLink, strpos($nextLink, '?') + 1), $options);
$results = $this->gaService->data_ga->call('get', [$options], "Google_Service_Analytics_GaData");
}
} while ($nextLink);
我想你可能會專門查看聯繫人API。您不妨試圖蜷縮這個新鏈接,看看您是否得到了結果。最近我正在看這個。我也認爲可能會在對象上調用getNext()。 –
實際上,它是Analytics API。這些代碼在各種不同的服務中應該是通用的,因爲Google_Service_Analytics_DataGa_Resource幾乎可以繼承Google_Service_Resource的所有內容。唯一的功能是'get'(在GA對象上)和'call'(在超類上)。 'get'只是爲'call'設置一些參數,然後調用它。 –