-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPhpHandler.php
More file actions
38 lines (28 loc) · 794 Bytes
/
PhpHandler.php
File metadata and controls
38 lines (28 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once('lib/ScavengerHandler.php');
require_once('lib/TwiMLHelper.php');
include_once('lib/AuthenticationHandler.php');
do_authenticate();
// header("content-type: text/xml");
$message = $_GET;
$format = $message["format"];
$Scavenger = new ScavengerHandler($message, $entityManager);
$response_body = $Scavenger->CreateResponse($message);
if (!empty($response_body["body"]))
{
$output = "";
if ($format == "xml")
{
$xml = format_TwiML($response_body);
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xml);
$xmlDoc->formatOutput=true;
$output = "<pre style='white-space: pre-wrap'>" . htmlentities($xmlDoc->saveXML()) . "</pre>";
}
else
{
$output = $response_body["body"];
}
echo $output;
}
?>