# Source for file Nabaztag.php

Documentation is available at Nabaztag.php

1. <?php
2. /**
3. * Class: Nabaztag
4. *
5. * The Nabaztag API.
6. * Part of Yahoo! Hack Day London.
7. *
8. * @author Aral Balkan
9. ***/
11. // Require base service class
12. require_once("../BaseService.php");
14. class Nabaztag extends BaseService
15. {
16. // Replace these with your own serial
17. // number and token from nabaztag.com.
18. var $sn = "0013d384686d";
19. var $token = "1182055607";
21. /**
22. * Sends a message for a Nabaztag bunny to speak.
23. *
24. * If you call this method without sending a serial number and token, it will use the
25. * serial number and token defined in the service class. For the service class on the
26. * SWX public gateway, this means that Aral's bunny will speak it. (Really, so be nice!) :)
27. *
28. * @param (str) Message to speak.
29. * @param (str, optional) Serial number of the bunny you want to send the message to.
30. * @param (str, optional) Token for the bunny you want to send the message to.
31. *
32. * @return void
33. * @author Aral Balkan
34. ***/
35. function talk ($tts, $sn = NULL, $token = NULL)
36. {
37. $url = "http://api.nabaztag.com/vl/FR/api.jsp";
38. $args = array('tts' => $tts);
40. $this->_addSerialToken(&$args, $sn, $token);
42. $result = $this->_call($url, $args);
44. return $result;
45. }
47. function _addSerialToken(&$args, $sn = NULL, $token = NULL)
48. {
49. $sn = ($sn == NULL) ? $this->sn : $sn;
50. $token = ($token == NULL) ? $this->token : $token;
52. $args['sn'] = $sn;
53. $args['token'] = $token;
54. }
55. }
57. ?>

Documentation generated on Fri, 06 Jul 2007 19:54:51 +0100 by phpDocumentor 1.3.1