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  
-14%
Le deal à ne pas rater :
Apple MacBook Air (2020) 13,3″ Puce Apple M1 – RAM 8Go/SSD 256Go
799 € 930 €
Voir le deal

 

 Fonction non fonctionnelle

Aller en bas 
3 participants
AuteurMessage
Humanbomb
Bronze Nabz
Bronze Nabz
Humanbomb


Age : 29
Localisation : DTC
Nabaztag : Humanztag (V1)
Nbr de messages : 167
Carottes : 5285

Fonction non fonctionnelle Empty
MessageSujet: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 12:25

Salut tous le monde nabzciao

Je suis en train de coder un "function.php" pour l'API du Nabaztag en PHP4

Lorsque je mets
Code:
<?php
require_once('function.php');
echo tts("[b]***masqué***[/b]", "[b]***masqué***[/b]", "FR-Gertrude", "Bienvenue+sur+mon+site");
?>

La page me renvoit (sur serveur local & distant)
Citation :
Erreur: HTTPOK

Voici le code du function.php
Code:
<?php
$UrlAPI = "http://api.nabaztag.com/vl/FR/api.js";

function get_content ($url) {
     $ch = curl_init();
     curl_setopt ($ch, CURLOPT_URL, $url);
     curl_setopt ($ch, CURLOPT_HEADER, 0);
     curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
     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 "Erreur: HTTP";
      }
};

function tts ($serial, $token, $voice, $message) {
      $UrlAPI = "http://api.nabaztag.com/vl/FR/api.js";
      if(!empty($serial) & !empty($token) & !empty($voice) & !empty($message)) {
      $urlNabaztag = $UrlAPI."?sn=".$serial."&token=".$token."&voice=".$voice."&tts=".$message."";

      if(@$PosLeft != "") $urlNabaztag .= "&posleft=".$_POST['PosLeft'];
      if(@$PosRight != "") $urlNabaztag .= "&posright=".$_POST['PosRight'];
      
      echo get_content($urlNabaztag);
      return "OK";
      } else {return "Erreur: variable manquante";}
};
?>

Ou ai-je foirer ?
Merci d'avance
Humanbomb
Revenir en haut Aller en bas
http://humanbomb.servehttp.com/
Phabbrrysse
Nabazteur Voyageur
Nabazteur Voyageur
Phabbrrysse


Age : 37
Localisation : Sassenage
Nabaztag : PhormiBBrrysse et Pharramyneu (V2)
Nbr de messages : 14389
Carottes : 13141

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 13:15

Bonjour

en lisant la comme ca j'en sais rien ...

A mon avis sur un forum de php tu auras plus de réponses ... pas bcp de dev ici :s
Revenir en haut Aller en bas
http://phabbrrysse.fr/
Humanbomb
Bronze Nabz
Bronze Nabz
Humanbomb


Age : 29
Localisation : DTC
Nabaztag : Humanztag (V1)
Nbr de messages : 167
Carottes : 5285

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 13:59

Ok, merci quand même yellownabzsmile
Revenir en haut Aller en bas
http://humanbomb.servehttp.com/
Humanbomb
Bronze Nabz
Bronze Nabz
Humanbomb


Age : 29
Localisation : DTC
Nabaztag : Humanztag (V1)
Nbr de messages : 167
Carottes : 5285

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 14:12

Le problème était l'adresse de l'API .. il manquait un p a la fin nabzcache
Revenir en haut Aller en bas
http://humanbomb.servehttp.com/
Moon´s Heart
Crazy Geek
Crazy Geek
Moon´s Heart


Age : 55
Localisation : Liège, Belgique
Nabaztag : Irina (tag³), Ryu (tag³), Summer (tag³), Tchantchès (tag³ mutant humanoïde), Yoko (tag³)
Nbr de messages : 15886
Carottes : 103415

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 17:03

L'API fait de la résistance! nabzlol
Revenir en haut Aller en bas
http://www.moonsheart.com
Humanbomb
Bronze Nabz
Bronze Nabz
Humanbomb


Age : 29
Localisation : DTC
Nabaztag : Humanztag (V1)
Nbr de messages : 167
Carottes : 5285

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 18:53

je me suis fait un petit function.php que je vais utiliser d'abord sur mon lapin et pourquoi pas sur un site a usage publique ? thumbsupsmileyanim
Revenir en haut Aller en bas
http://humanbomb.servehttp.com/
Humanbomb
Bronze Nabz
Bronze Nabz
Humanbomb


Age : 29
Localisation : DTC
Nabaztag : Humanztag (V1)
Nbr de messages : 167
Carottes : 5285

Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitimeDim 30 Mai 2010 - 21:36

Si vous checkez mon Nab Messenger : http://humanbomb.servehttp.com/nabaztag/ aux heures ou mon lapin dort vous ne pourrez pas laisser de message

yellownabzsmile API powaaaa
Revenir en haut Aller en bas
http://humanbomb.servehttp.com/
Contenu sponsorisé





Fonction non fonctionnelle Empty
MessageSujet: Re: Fonction non fonctionnelle   Fonction non fonctionnelle Icon_minitime

Revenir en haut Aller en bas
 
Fonction non fonctionnelle
Revenir en haut 
Page 1 sur 1

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... :: II. Nabaztag, Karotz, mir:ror, Dal:Dal (Violet Object Operating System) :: L'univers de Nabaztag :: Archives :: API-
Sauter vers: