Source for file Nabaztag.php
Documentation is available at
Nabaztag.php
<?php
/**
* Class: Nabaztag
*
* The Nabaztag API.
* Part of Yahoo! Hack Day London.
*
*
@author
Aral Balkan
***/
// Require base service class
require_once
(
"../BaseService.php"
)
;
class
Nabaztag
extends
BaseService
{
// Replace these with your own serial
// number and token from nabaztag.com.
var
$sn
=
"0013d384686d"
;
var
$token
=
"1182055607"
;
/**
* Sends a message for a Nabaztag bunny to speak.
*
* If you call this method without sending a serial number and token, it will use the
* serial number and token defined in the service class. For the service class on the
* SWX public gateway, this means that Aral's bunny will speak it. (Really, so be nice!) :)
*
*
@param
(str)
Message to speak.
*
@param
(str,
optional) Serial number of the bunny you want to send the message to.
*
@param
(str,
optional) Token for the bunny you want to send the message to.
*
*
@return
void
*
@author
Aral Balkan
***/
function
talk
(
$tts
,
$sn
= NULL
,
$token
= NULL
)
{
$url
=
"http://api.nabaztag.com/vl/FR/api.jsp"
;
$args
= array
(
'tts'
=>
$tts
)
;
$this
->
_addSerialToken
(
&
$args
,
$sn
,
$token
)
;
$result
=
$this
->
_call
(
$url
,
$args
)
;
return
$result
;
}
function
_addSerialToken
(
&
$args
,
$sn
= NULL
,
$token
= NULL
)
{
$sn
=
(
$sn
== NULL
)
?
$this
->
sn
:
$sn
;
$token
=
(
$token
== NULL
)
?
$this
->
token
:
$token
;
$args
[
'sn'
]
=
$sn
;
$args
[
'token'
]
=
$token
;
}
}
?>
Documentation generated on Fri, 06 Jul 2007 19:54:51 +0100 by
phpDocumentor 1.3.1