예제 #1
0
 public function testConstructor()
 {
     $response = new Response();
     $response->loadXML(file_get_contents('./mvr1.xml'));
     $response->parse();
     //Do something useful...
 }
예제 #2
0
파일: example.php 프로젝트: rmnanney/Adr
$request->setADRPort('12345');
$request->addOrder($requestOrder);
//Let's check out how the Request XML looks
//print 'REQUEST XML BEING SENT TO ADR:' . PHP_EOL . $request->getXML();
//Our Request is ready to send to ADR, but we're not actually doing it as I assume you do not have an account.
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.