function piwik_stats_api_request in Piwik Statistic Integration 7
Same name and namespace in other branches
- 7.2 piwik_stats.module \piwik_stats_api_request()
Sends a Piwik API request.
Parameters
string $piwik_url: URL to piwik.
string $token_auth: Authentication token needed to authenticate with piwik.
string $method: Piwik API request method.
int $site_id: Unique site ID of piwik.
string $period: Statistical period. Default is 'year' but also 'day', 'week' or 'month' is possible.
int $date: Statistic base date.
string $format: API return format. Default is XML but also CSV, TSV and JSON is possible.
Return value
object The returned object of drupal_http_request().
1 call to piwik_stats_api_request()
- piwik_stats_request_data in ./
piwik_stats.module - Requests and refreshes the Piwik Statistical data.
File
- ./
piwik_stats.module, line 387 - Integrates piwik statistics per node.
Code
function piwik_stats_api_request($piwik_url, $token_auth, $method, $site_id, $period = 'year', $date = 'now', $format = 'xml') {
$result_object = drupal_http_request(url($piwik_url, array(
'query' => array(
'module' => 'API',
'method' => $method,
'idSite' => $site_id,
'period' => $period,
'date' => $date,
'format' => $format,
'token_auth' => $token_auth,
'expanded' => TRUE,
),
)));
return $result_object;
}