-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetMVData.php
55 lines (49 loc) · 1.6 KB
/
getMVData.php
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
error_reporting(E_ALL);
//Setup the params and user data to pass to QM.
$QMSubName = "GRAB.CUST.DATA";
$user_input = $_REQUEST['custid'];
//$user_input = '1';
//
$qm_acct_path = '/qmdata/accts/TEST';
$server = $_SERVER['REMOTE_ADDR'];
//$QM_params_data = array();
//$QM_params_data['qm_acct_path'] = '/qmdata/accts/TEST';
//$QM_params_data['qm_cmd'] = $QMSubName;
//$QM_params_data['user_input'] = $user_input;
////Safe way of extracting info from an associative array.
//function rowValue($row,$key,$default = "")
//{
// return(isset($row[$key]) ? $row[$key] : $default);
//}
if(chdir($qm_acct_path))
{
$dir_path = '/WEBWINDOW';
$fileName = 'QMWEB_' . $server . '_' . time();
$inFile = $qm_acct_path . $dir_path . '/' . $fileName . '.in';
$outFile = $qm_acct_path . $dir_path . '/' . $fileName . '.out';
//Apparently this not only tests to see if the file is there, but, it also writes the file out?
if(file_put_contents($inFile,$user_input,LOCK_EX) !== false)
{
//chmod($inFile,0777);
putenv('QM_WEB_SUBNAME=' . $QMSubName);
putenv('QM_WEBWINDOW_FILE=' . $fileName);
exec("/usr/qmsys/bin/qm WEB.CALLER");
//chmod($outFile,0777);
$result = file_get_contents($outFile);
echo $result;
unlink($inFile);
unlink($outFile);
}
else
{
$error = array('error' => 'Unable to connect to the server at this time.');
echo json_encode($error);
}
}
else
{
$error = array('error' => 'Unable to connect to the server at this time.');
echo json_encode($error);
}
?>