minor change to prior commit
[openemr.git] / library / MedEx / MedEx_background.php
blobcb370a9a947dc09716d02772c45bb902cd12fd60
1 <?php
3 /**
4 * /library/MedEx/medex_background.php
6 * This file is executed as a background service. It synchronizes data with MedExBank.com,
7 * delivering events to be processed to MedEx AND receiving message outcomes from MedEx.
8 * MedEx_background.php receives message responses asynchronously.
9 * Consider setting this service to run q5 minutes in background_grounds:
10 * eg. every 5 minutes ==> active=1, execute_interval=5
12 * While anyone is logged into your OpenEMR instance, this will run.
13 * Consider adding a cronjob to run this file also, so messaging for upcoming events
14 * will run even if no one is logged in, eg. the office is closed/vacation etc
16 * eg. to run this file every 4 hours, crontab -e
17 * 0 0,4,8,12,16,20 * * * /usr/bin/env php ROOT_DIR/library/ajax/execute_background_services.php
18 * You can add " >> /tmp/medex.log " to output success/failure to a log file.
20 * @package MedEx
21 * @link http://www.MedExBank.com
22 * @author MedEx <support@MedExBank.com>
23 * @copyright Copyright (c) 2017 MedEx <support@MedExBank.com>
24 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
27 $ignoreAuth = true;
29 require_once(dirname(__FILE__) . "/../../interface/globals.php");
30 require_once(dirname(__FILE__) . "/API.php");
31 require_once(dirname(__FILE__) . "/../patient.inc");
33 function start_MedEx()
35 $MedEx = new MedExApi\MedEx('MedExBank.com');
36 $logged_in = $MedEx->login('1');
37 if ($logged_in) {
38 echo "Completed @ " . date("Y-m-d H:i:s") . "\n";
39 } else {
40 echo $MedEx->getLastError();
41 echo "Failed @ " . date("Y-m-d H:i:s") . "\n";