public function gapi::requestAccountData in Google Analytics Statistics 7.x
Same name and namespace in other branches
- 7.2 includes/gapi.class.php \gapi::requestAccountData()
- 7 includes/gapi.class.php \gapi::requestAccountData()
Request account data from Google Analytics
Parameters
Int $start_index OPTIONAL: Start index of results:
Int $max_results OPTIONAL: Max results returned:
File
- inc/
gapi.class.php, line 82
Class
- gapi
- GAPI - Google Analytics PHP Interface
Code
public function requestAccountData($start_index = 1, $max_results = 20) {
$response = $this
->httpRequest(gapi::account_data_url, array(
'start-index' => $start_index,
'max-results' => $max_results,
), null, $this
->generateAuthHeader());
if (substr($response['code'], 0, 1) == '2') {
return $this
->accountObjectMapper($response['body']);
}
else {
throw new Exception('GAPI: Failed to request account data. Error: "' . strip_tags($response['body']) . '"');
}
}