public function gapi::requestAccountData in Google Analytics Statistics 7.2
Same name and namespace in other branches
- 7 includes/gapi.class.php \gapi::requestAccountData()
- 7.x inc/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
- includes/
gapi.class.php, line 91
Class
- gapi
- GAPI - Google Analytics PHP Interface
Code
public function requestAccountData($start_index = 1, $max_results = 1000) {
$get_variables = array(
'start-index' => $start_index,
'max-results' => $max_results,
);
$url = new gapiRequest(gapi::account_data_url);
$response = $url
->get($get_variables, $this->auth_method
->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']) . '"');
}
}