<?php

require_once "./plivo.php";
$from_number = $_REQUEST['From'];
$callers = array('1111111111' => 'ABCDEF', '2222222222' => 'VWXYZ', '3333333333' => 'QWERTY');
$r = new Response();
if (array_key_exists($from_number, $caller)) {
    $body = "Hello {$caller[$from_number]}";
    $r->addSpeak($body);
} else {
    $body = "Hello Stranger!";
    $r->addSpeak($body);
}
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Output
<Response>
    <Speak>Hello,ABCDEF</Speak>
</Response>
*/
Example #2
0
<?php

require_once 'plivo.php';
$record_url = $_REQUEST['RecordUrl'];
$response = new Response();
$getdigits = $response->addGetDigits(array('action' => 'http://' . $_SERVER["SERVER_NAME"] . '/plivo-voicemail/follow-action.php?RecordUrl=' . $record_url, 'method' => 'GET'));
$getdigits->addSpeak('Press 1 to play your recording');
$getdigits->addSpeak('Press 2 to start over');
$getdigits->addSpeak('Press 3 to save and exit');
header('content-type: text/xml');
echo $response->toXML();