Example #1
0
$cred = getErxCredentials();
$path = getErxSoapPath();
$path = explode(';', $path);
$client = new SoapClient($path[0]);
$xml1_0['credentials']['PartnerName'] = $cred['0'];
$xml1_0['credentials']['Name'] = $cred['1'];
$xml1_0['credentials']['Password'] = $cred['2'];
$erxSiteID = sqlQuery("SELECT federal_ein FROM facility WHERE primary_business_entity='1'");
$account = sqlQuery("SELECT * FROM users AS u LEFT JOIN facility AS f ON f.id=u.facility_id WHERE u.username=?", array($_SESSION['authUser']));
$xml1_0['accountRequest']['AccountId'] = '1';
$xml1_0['accountRequest']['SiteId'] = $erxSiteID['federal_ein'];
$xml1_0['patientRequest']['PatientId'] = $patientid;
$user_details = sqlQuery("SELECT * FROM users WHERE id = ?", array($_SESSION['authUserID']));
$xml1_0['patientInformationRequester']['UserType'] = 'D';
$xml1_0['patientInformationRequester']['UserId'] = $user_details['id'];
$xml = $client->GetPatientAllergyHistoryV3($xml1_0);
$xml_response = $xml->GetPatientAllergyHistoryV3Result->XmlResponse;
$xml_response_count = $xml->GetPatientAllergyHistoryV3Result->RowCount;
$xml_response = base64_decode($xml_response);
$xmltoarray = new xmltoarray_parser_htmlfix();
//create instance of class
$xmltoarray->xmlparser_setoption(XML_OPTION_SKIP_WHITE, 1);
//set options same as xml_parser_set_option
$xmltoarray->xmlparser_setoption(XML_OPTION_CASE_FOLDING, 0);
$xmltoarray->xmlparser_fix_into_struct($xml_response);
//fixes html values for XML
$array = $xmltoarray->createArray();
//creates an array with fixed html values
foreach ($array as $key => $value) {
    $array[$key] = $xmltoarray->fix_html_entities($value);
    //returns proper html values