Example #1
0
 public function testConstructor()
 {
     $response = new Response();
     $response->loadXML(file_get_contents('./mvr1.xml'));
     $response->parse();
     //Do something useful...
 }
Example #2
0
try {
    $response = $request->send();
} catch (Exception $e) {
    print "Exception found : " . $e->getMessage();
}
echo "Response retreived.";
print $response->getXML();
exit;
//Since we aren't actually going to communicate with ADR, so we have to fake this out by calling response::loadXML below
//There are four different XML files you can use to simulate different scores (see below)
$response = new Response();
//$response->loadXML(file_get_contents(__DIR__ . '/response.standard.xml'));
$response->loadXML(file_get_contents(__DIR__ . '/response.preferred.xml'));
//$response->loadXML(file_get_contents(__DIR__ . '/response.decline.xml'));
//$response->loadXML(file_get_contents(__DIR__ . '/response.refer.xml'));
$response->parse();
//If you want to have your response persist to the filesystem
//$response->save('./mvr2.xml');
//Our Response is received and parsed.  Lets print out the XML so you can look it over.
print PHP_EOL . PHP_EOL . "Simulated response from ADR:" . PHP_EOL;
print $response->getXML();
print PHP_EOL . PHP_EOL . "Begin custom processing of response XML:" . PHP_EOL;
//At this point, the communication with ADR is done, and you can do whatever you need with the response data.  This
//example involves scoring the data, based on our Codes, Rules and RuleSets (in the SQL).  This does little more than
//give an idea of what you might want to do with the data.
//History nodes have violations, violations have AVD Codes which we will score.
$historyNodes = $response->getHistoryNodes();
$pointTotal = 0;
$decisions = array();
$rulesHits = array();
if (count($historyNodes)) {