[PLUGINS] +piwik
[ptitvelo/web/www.git] / www / plugins / spip_piwik_2_0 / inc / piwik_recuperer_data.php
1 <?php
2
3 if (!defined("_ECRIRE_INC_VERSION")) return;
4
5 /**
6 * Fonction de communication avec l'API REST du serveur Piwik
7 *
8 * @param string $piwik_url Url du serveur
9 * @param string $token_auth Le token d'autentification du serveur
10 * @param string $module [optional]
11 * @param string $method
12 * @param string $format [optional]
13 * @param array $options [optional]
14 * @return string Le contenu de la réponse
15 */
16 function inc_piwik_recuperer_data_dist($piwik_url,$token_auth,$module='API',$method,$format='PHP',$options=array()){
17
18 $url = parametre_url($piwik_url,'token_auth',$token_auth);
19 $url = parametre_url($url,'module','API','&');
20 $url = parametre_url($url,'format',$format,'&');
21 $url = parametre_url($url,'method',$method,'&');
22 if(is_array($options)){
23 foreach($options as $cle => $val){
24 $url = parametre_url($url,$cle,$val,'&');
25 }
26 }
27
28 include_spip('inc/distant');
29 $content = recuperer_page($url);
30
31 return $content;
32 }
33 ?>