Skip to content

Instantly share code, notes, and snippets.

@rajurayhan
Created February 20, 2020 11:57
Show Gist options
  • Save rajurayhan/a73fa30fd43d79b7b02186e69bd83f90 to your computer and use it in GitHub Desktop.
Save rajurayhan/a73fa30fd43d79b7b02186e69bd83f90 to your computer and use it in GitHub Desktop.
Attendance Integration
<?php
// echo phpinfo();
$baseURL = 'http://192.168.10.241:8080/simecschool/';
$attendanceAPI = $baseURL.'frontend/apiattendance';
// echo $attendanceAPI;
$data = array(
'punchID' => '123456',
'date' => '19-02-2020',
'time' => '04:50:30',
'node' => 5
);
$curl = curl_init();
// /Set some options - we are passing in a useragent too here
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => "http://192.168.10.241:8080/simecschool/frontend/apiattendance?punchID=".$data['punchID']."&date=".$data['date']."&time=".$data['time']."&node=".$data['node'],
CURLOPT_USERAGENT => 'SIMEC PATHSHALA ATTENDANCE SYNCHRONISER'
]);
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
// var_dump($resp);
$response = json_decode($resp, true);
if($response['status'] == 'success'){
// Changes Active Status from your DB.
}
else{
// Don't change and try again later
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment