Back-end driven VoicePHP application January 27, 2009

All practical applications need to use the data on the back-end to drive certain aspect of the application behavior. For voice based interaction, it can be quite easily done in VoicePHP.

Diagram below shows a typical application flow.

Back-end driven application

Key steps to look at:

Consider the sample code below. It is split into a front-end VoicePHP file that interacts with the user and a back-end PHP file (back-end could be anything – PHP, ASP, .NET etc.).

<?php
// frontend.voicephp

// ... 

$pin prompt("Enter Your Pin Number"); // Back-end can use 
$result notify("http://backend.myserver.com/authenticate.php?pin=$pin");

echo 
"You name is $result";

// ...

?>

Download source code

<?php
// backend.php

//PIN used to validate the user.
$pin $_REQUEST['pin'];

// ... assuming database is connected .. 
$result mysql_query("select * from user_info where userpin = '$pin'");
$row mysql_fetch_row($result);
// ... do other processing and return ...

// $row[1] -> User Name
echo "$row[1]";
?>

Download source code

As you can see, in the front-end VoicePHP file,

In the back-end script,

** Note:  If one was using the “premise model”, the VoicePHP script could interact with the database directly.

Does'nt it look easy? Try VoicePHP for yourself and feel free to modify the above script. VoicePHP is easy and accessible from your free TringMe account. More details at http://voicephp.com/howitworks.html

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

2 Comments so far
  1. Ehsan January 27, 2009 11:45 am

    hi

    please tell me the way to use voicephp

    1) its requirment

  2. [...] Back-end driven VoicePHP application [...]

© Copyright TringMe., All rights reserved. - Blog powered by Wordpress - Designed by Speckyboy