Forum des Objets Communicants et Solutions pour les Libérer...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
Le Deal du moment : -39%
Pack Home Cinéma Magnat Monitor : Ampli DENON ...
Voir le deal
1190 €
anipassion.com

 

 PHP class

Aller en bas 
AuteurMessage
Snelvuur
Lapin nain
Lapin nain



Nbr de messages : 5
Carottes : 6575

PHP class Empty
MessageSujet: PHP class   PHP class Icon_minitimeVen 12 Mai 2006 - 19:09

<?php
class nabaz{

// change these settings ofcourse dummy..

var $sn="0123235455093AA";
var $token="114728232355271";
var $grabData="";

function link() {
$this->url="http://www.nabaztag.com/vl/FR/api.jsp?sn=" . $this->sn . "&token=" . $this->token;
}

function getData($url){
$file = @fopen($this->url, 'rb', '0');
if ($file){
if ($fsize = @filesize($filename)){
$data = fread($file, $fsize);
}else{
while (!feof($file)){
$data .= fread($file, 1024);
}
}
fclose($file);
}
$this->grabData=$data;
}

function showPage(){
$this->getData($this->url);
echo $this->grabData;

// Turn on to see the url string
// print $this->url;

}

function leftear($leftear){
$this->url.="&posleft=$leftear";
}

function rightear($rightear){
$this->url.="&posright=$rightear";
}

function speak($tex){
$text = str_replace(" ","+",$tex);
$this->url.="&tts=$text";
}

// use this instead of showpage if you dont want an output

function runPage(){
$this->getData($this->url);
}
}

?>

(if you want tabbing grab it from http://home.rfje.org/test/nabaz/nabaz.txt )


Dernière édition par le Ven 12 Mai 2006 - 19:14, édité 1 fois
Revenir en haut Aller en bas
Snelvuur
Lapin nain
Lapin nain



Nbr de messages : 5
Carottes : 6575

PHP class Empty
MessageSujet: Re: PHP class   PHP class Icon_minitimeVen 12 Mai 2006 - 19:12

To use this class, an example:

The nab->link is needed, the left and right ear and speak can be used, you dont have to have all 3 of them, but you can. It stacks them.

The showpage runs your options and gives the api output, use runpage if you dont want any output.

<?

include("nabaz.php");

$nab=new nabaz();
$nab->link();
$nab->leftear("1");
$nab->rightear("1");
$nab->speak(" What did you do today, you where browsing the internet again right Eric?");
$nab->showPage();
// $nab->runPage();
?>

Give it a try, or improve it, or any idea's are welcome.

Cheers,
Erik
Revenir en haut Aller en bas
 
PHP class
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Karotz full Php Class - Rel. 1.0b
» Karotz Php Class : mise à jour

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: IV. I Don't Speak French! :: Archives :: API & Developments-
Sauter vers: