hasonaut Lapin nain

Localisation : germany Nbr de messages : 3 Carottes : 5874
 | Sujet: Nabaztag as a visitor counter Jeu 8 Nov 2007 - 17:07 | |
| hi,
I was wondering if it would be possible to use the Nabaztag as some kind of statcounter for my website or blog. I don't want him to well me how many users visited my site over the day but it would be great if f.e. the nase would blink evrytime a user visits a certain webpage. Wouldn't that be possible by simpla adding an API-URL into a 1x1 pixel Iframe on that website?
Thanks and Best Regards,
hasonaut | |
|
nabazland Karotzeur taquin

Age : 56 Localisation : Rouen - France Nabaztag : Caulfield (v2.1) Nbr de messages : 9783 Carottes : 12994
 | Sujet: Re: Nabaztag as a visitor counter Jeu 8 Nov 2007 - 18:46 | |
| It's possible...
Eah time a new visitor enter my website, http://nabzone.com my nabaztag play a little choregraphy...
You must put some php code on your site to do that, because of the session. Its not as simple as adding an API-URL into a 1x1 pixel Iframe.... _____________________________
| |
|
hasonaut Lapin nain

Localisation : germany Nbr de messages : 3 Carottes : 5874
 | Sujet: Re: Nabaztag as a visitor counter Ven 9 Nov 2007 - 19:06 | |
| that sounds great. would you distribute that php?
thankd and best regards | |
|
nabazland Karotzeur taquin

Age : 56 Localisation : Rouen - France Nabaztag : Caulfield (v2.1) Nbr de messages : 9783 Carottes : 12994
 | Sujet: Re: Nabaztag as a visitor counter Ven 9 Nov 2007 - 20:33 | |
| Do you know PHP coding or not at all ? _____________________________
| |
|
hasonaut Lapin nain

Localisation : germany Nbr de messages : 3 Carottes : 5874
 | Sujet: Re: Nabaztag as a visitor counter Ven 9 Nov 2007 - 20:52 | |
| | |
|
nabazland Karotzeur taquin

Age : 56 Localisation : Rouen - France Nabaztag : Caulfield (v2.1) Nbr de messages : 9783 Carottes : 12994
 | Sujet: Re: Nabaztag as a visitor counter Ven 9 Nov 2007 - 21:29 | |
| You can try that... You need CURL library on your server... replace $Serial = "0000000"; $Token = "1111111"; with the serial and token of your nabaztag, and study the api documentation ton create your own choregraphy ($chor) I didn't test, but it should be something like that : - Code:
-
<? if (!isset($_SESSION)) { @session_start(); }
$urlAPI = "http://api.nabaztag.com/vl/FR/api.jsp"; $Serial = "0000000"; $Token = "1111111";
function get_content($url) { global $EtatComm; global $infoHTTP; global $infoERR;
$ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_TIMEOUT, $curlTimeout); curl_setopt ($ch, CURLOPT_HTTPHEADER, array( "Content-Type: text/xml; charset=UTF-8", "Accept-Language: fr-fr", )); ob_start(); curl_exec ($ch); $infoHTTP = curl_getinfo($ch,CURLINFO_HTTP_CODE); $infoERR = curl_error($ch);
curl_close ($ch); $string = ob_get_contents(); ob_end_clean();
if (substr($infoHTTP,0,1) == "2") { return $string; } else { return false; } }
if (!isset($_SESSION['welcome'])) { $_SESSION['welcome'] = "ok";
$chor = "1";
$chor .= ",0,led,0,255,0,0"; $chor .= ",0,led,1,255,0,0"; $chor .= ",0,led,2,0,0,0"; $chor .= ",0,led,3,0,0,0"; $chor .= ",0,led,4,0,0,0";
$chor .= ",2,led,0,0,0,0"; $chor .= ",2,led,1,0,0,0"; $chor .= ",2,led,2,255,0,0"; $chor .= ",2,led,3,0,0,0"; $chor .= ",2,led,4,0,0,0";
$prevenir = get_content($urlAPI."?sn=".$Serial."&token=".$Token."&ttlive=86400&idapp=123&chortitle=WEB%20".rawurlencode($_SERVER['REMOTE_ADDR'])."&chor=".$chor); } ?> _____________________________
| |
|
Contenu sponsorisé
 | Sujet: Re: Nabaztag as a visitor counter  | |
| |
|