<?php include "../includes/dhims2.php"; $return = DHIMS2API::getDataElements($_REQUEST['datasetid'], $_REQUEST['dhims2username'], $_REQUEST['dhims2password']); //file_put_contents("dhims2.txt", $_REQUEST['orgunitid']); if ($return === 404 || empty($return)) { echo "404"; } else { if ($return === 401) { echo "false"; } else { echo $return; } }
public static function getDataElementsCombo($dataElementID, $username, $password) { $URL = DHIMS2API::$mode == "test" ? DHIMS2API::$testBaseURL : DHIMS2API::$liveBaseURL; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "{$URL}/api/dataElements/{$dataElementID}" . '.json'); curl_setopt($ch, CURLOPT_HEADER, "application/json"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}"); $return = curl_exec($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //file_put_contents("dhims2.txt", "$URL/api/dataElements/$dataElementID".'.json'); curl_close($ch); if ($status_code === 200) { $dataelement = json_decode($return, true); $catcombo = $dataelement["categoryCombo"]; if (!empty($catcombo)) { return DHIMS2API::getComboOptions($catcombo["href"], $username, $password); } else { return "true"; } } else { return $status_code; } }
<?php include "../includes/dhims2.php"; $return = DHIMS2API::Authenticate($_REQUEST['dhims2username'], $_REQUEST['dhims2password']); //file_put_contents("dhims2.txt",$return); if ($return === 404 || empty($return)) { echo "404"; } else { if ($return === 401) { echo "false"; } else { echo $return; } }
<?php include "../includes/dhims2.php"; $return = DHIMS2API::getDataElementsCombo($_REQUEST['dataElementID'], $_REQUEST['dhims2username'], $_REQUEST['dhims2password']); //file_put_contents("dhims2.txt", $_REQUEST['orgunitid']); if ($return === 404 || empty($return)) { echo "404"; } else { if ($return === 401) { echo "false"; } else { echo $return; } }
<?php include "../includes/dhims2.php"; $return = DHIMS2API::getDataSets($_REQUEST['orgunitid'], $_REQUEST['dhims2username'], $_REQUEST['dhims2password']); //file_put_contents("dhims2.txt", $_REQUEST['orgunitid']); if ($return === 404 || empty($return)) { echo "404"; } else { if ($return === 401) { echo "false"; } else { echo $return; } }