File manager - Edit - /var/www/ams.cmtc.ac.th/pages/getRMSdata-std2018_studentgroup.php
Back
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620"> <?php error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE); function callAPI($method, $url, $data){ $curl = curl_init(); switch ($method){ case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // OPTIONS: curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 60); //timeout in seconds // EXECUTE: $result = curl_exec($curl); if(!$result){die("Connection Failure");} curl_close($curl); return $result; } $data_array = ''; $data_link = "$url_rms/api_connection.php?app_name=cmtcapp&data=std2018_studentgroup"; $make_call = callAPI('POST', $data_link, json_encode($data_array)); // ����Ѻ���ŧ charset $make_call_thai = iconv("UTF-8", "TIS-620",$make_call); //echo $make_call_thai; //�ʹ�����ٻẺ json $response = json_decode($make_call, true); // ������� [????] ����������Һ�ҧ //echo print_r ($response); //ź������㹵��ҧ������ $result=emptytable("std2018_studentgroup"); foreach ($response as $key => $jsons) { $x++; echo"<font size=\"-2\">"; echo $x .' - '; echo $jsons[academicYear].' - '.$jsons[semester].' - '.$jsons[school_id].' - '.$jsons[datasync_time].' - '.$jsons[grade].' - '.$jsons[groupCode].' - '.$jsons[groupName].' - '.$jsons[groupAbbr].' - '.$jsons[teacherIdcard].' - '.$jsons[teacherFirstname].' - '.$jsons[teacherLastname].' - '.$jsons[ClassRoomID]; echo '<br>'; echo"</font>"; // ������ SQL 㹡�� insert ŧ database insert("'$jsons[academicYear]','$jsons[semester]','$jsons[school_id]','$jsons[datasync_time]','$jsons[grade]','$jsons[groupCode]','$jsons[groupName]','$jsons[groupAbbr]','$jsons[teacherIdcard]','$jsons[teacherFirstname]','$jsons[teacherLastname]','$jsons[ClassRoomID]'","std2018_studentgroup"); } //���� update ������ insert("NULL,'2','$day_log'","regis_database_log"); ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 1 |
proxy
|
phpinfo
|
Settings