What would you like our Nabaztag/tag to say or do?
array(
'SN' => '000000000000',
'TOKEN' => '1231231231'
),
'nabaz2' => array(
'SN' => '000000000001',
'TOKEN' => '1231231232'
)
);
if ($_SERVER['REQUEST_METHOD']=='POST') {
$temp_val=$_POST['owner'];
$curr_rabbit=array($rabbit[$temp_val]);
foreach($curr_rabbit as $key ) {
$STRING=$URL."sn=".$key[SN]."&token=".$key[TOKEN];
}
}
// $STRING=$URL."sn=".$SN."&token=".$TOKEN;
if ($_POST['action_class']=="ears") {
$STRING=$STRING."&ears=ok";
} elseif($_POST['action_class']=="talk") {
$STRING=$STRING."&posright=".$_POST['posright'];
$STRING=$STRING."&posleft=".$_POST['posleft'];
if (!empty($_POST['tts'])) {
$FLAG=1;
$tts=str_replace(" ","+",$_POST['tts']);
$STRING=$STRING."&tts=".$tts;
}
if (!empty($_POST['voice'])) {
// $FLAG=1;
$STRING=$STRING."&voice=".$_POST['voice'];
}
if (($_POST['speed']!=100) && $FLAG==1) {
$STRING=$STRING."&speed=".$_POST['speed'];
}
}
print ("$STRING");
print ("
");
if ($_SERVER['REQUEST_METHOD']=='POST') {
$fp = fopen( $STRING, 'r');
$content = "";
while( !feof( $fp ) ) {
$buffer = trim( fgets( $fp, 4096 ) );
$content .= $buffer;
}
// This piece of code was picked on the net, at http://il2.php.net/xml_parser_create and was written by mmustafa at vsnl dot com
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $content, $vals, $index);
xml_parser_free($xml_parser);
$params = array();
$level = array();
foreach ($vals as $xml_elem) {
if ($xml_elem['type'] == 'open') {
if (array_key_exists('attributes',$xml_elem)) {
list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
} else {
$level[$xml_elem['level']] = $xml_elem['tag'];
}
}
if ($xml_elem['type'] == 'complete') {
$start_level = 1;
$php_stmt = '$params';
while($start_level < $xml_elem['level']) {
$php_stmt .= '[$level['.$start_level.']]';
$start_level++;
}
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
eval($php_stmt);
}
}
// echo "";
// print_r ($params);
// echo "
";
if ($_POST['action_class']=="ears") {
foreach($params as $volabc => $valabc) {
$left_status=$valabc[LEFTPOSITION];
$right_status=$valabc[RIGHTPOSITION];
}
print("
\n Left Ear Position: $left_status \n");
print("
\n Right Ear Position: $right_status \n");
print("
\n");
} else {
print("$content");
}
}
print ("
\n");
show_form($_POST['owner'],$_POST['posright'],$_POST['posleft'],$_POST['voice'],$_POST['speed'],$_POST['pitch'],$_POST['tts']);
?>