Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.118.151.112
<?php
function sduvaldata($aobj_context)
{
$fexamdate = $aobj_context->mobj_data['examdate'];
$subcode = $aobj_context->mobj_data['subcode'];
$user = "webuser";
$password = "YOk1PvmvqB";
$url = "http://115.240.134.84:90/iondvs_sduaher/api/v1/export-marks";
$body = "crs_code={$subcode}&event_name={$fexamdate}";
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, $url);
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$user:$password");
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, $body );
$result2 = curl_exec($ch);
//curl_close( $ch );
$resjuno = json_decode($result2,true);
//echo $resjuno;
$resdata = $resjuno['data'];
echo $resdata;
if($resdata =='Invalid request')
{
$query = "INSERT ignore INTO logisys3_sdu.resvalapi (fexamdate,fsubcode,fdate,fmsg)
VALUES
('{$fexamdate}','{$subcode}',now(),'{$resdata}')";
$upres = $aobj_context->mobj_db->Execute($query);
echo "Exam Date: ".$fexamdate." Subcode: ".$subcode."</br>";
}else if($resdata =='No data available to export.')
{
echo $resdata;
}
else
{
foreach($resdata as $val)
{
$regno = $val['student_token_id'];
$degcode = $val['program_acronym'];
$subcode = $val['course_code'];
$subname = str_replace("'","`",$val['course_acronym']);
$uniqid = $val['student_unique_id'];
$feditversion = $val['idvs_coe_edit_version'];
$v1 = $val['V1'];
$v1name = $val['Evaluator_V1'];
$v2 = $val['V2'];
$v2name = $val['Evaluator_V2'];
$v3 = $val['V3'];
$v3name = $val['Evaluator_V3'];
$v4 = $val['V4'];
$v4name = $val['Evaluator_V4'];
$query = "INSERT ignore INTO logisys3_sdu.resvalapi (fexamdate,fregno,funiqid, fdegname, fsubcode, fsubname, feditversion,
fv1, fv1teach, fv2, fv2teach, fv3, fv3teach, fv4, fv4teach, fdate,fmsg)
VALUES
('{$fexamdate}','{$regno}','{$uniqid}', '{$degcode}','{$subcode}','{$subname}','{$feditversion}',
'{$v1}','{$v1name}','{$v2}','{$v2name}','{$v3}','{$v3name}','{$v4}','{$v4name}',now(),'success')
on duplicate key update fv1 = '{$v1}', fv2 = '{$v2}',
fv1teach = '{$v1name}',fv2teach = '{$v2name}',fv3 = '{$v3}',fv3teach = '{$v3name}',fv4 = '{$v4}',fv4teach = '{$v4name}',
funiqid = '{$uniqid}',fupddate = now()";
//var_dump($query);
$upres = $aobj_context->mobj_db->Execute($query);
echo "regno: ".$regno." Subcode: ".$subcode."</br>";
}
}
}
?>
|