File manager - Edit - /var/www/ams.cmtc.ac.th/pages/getRMSdata-std2018_student.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_student"; $make_call = callAPI('POST', $data_link, json_encode($data_array)); //$make_call = callAPI('POST', 'http://rms.cmtc.ac.th/api_connection.php?app_name=cmtcapp&data=std2018_student', 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_student"); foreach ($response as $key => $jsons) { $x++; echo"<font size=\"-2\">"; echo $x .' - '; echo $jsons[studentID].' - '.$jsons[prefixID].' - '.$jsons[idcard].' - '.$jsons[firstname].' - '.$jsons[surname].' - '.$jsons[schoolName].' - '.$jsons[studentCode].' - '.$jsons[middlename].' - '.$jsons[gender].' - '.$jsons[firstnameEn].' - '.$jsons[surnameEn].' - '.$jsons[nickname].' - '.$jsons[birthday].' - '.$jsons[nationalityID].' - '.$jsons[raceID].' - '.$jsons[religionID].' - '.$jsons[tel].' - '.$jsons[fax].' - '.$jsons[email].' - '.$jsons[groupCode].' - '.$jsons[groupName].' - '.$jsons[groupAbbr].' - '.$jsons[gradeNameTh].' - '.$jsons[entranceDate].' - '.$jsons[entranceYear].' - '.$jsons[entranceSemester].' - '.$jsons[studentStatusNameTh].' - '.$jsons[retireYear].' - '.$jsons[retireSemester].' - '.$jsons[graduateDate].' - '.$jsons[causeRetire].' - '.$jsons[houseId].' - '.$jsons[houseNumber].' - '.$jsons[moo].' - '.$jsons[soi].' - '.$jsons[street].' - '.$jsons[tumbolCode].' - '.$jsons[zipCode].' - '.$jsons[majorNameTh].' - '.$jsons[minorNameTh].' - '.$jsons[datasync_time].' - '.$jsons[bloodName].' - '.$jsons[parentPrefixId].' - '.$jsons[parentFirstname].' - '.$jsons[parentSurname].' - '.$jsons[parentRelation].' - '.$jsons[parentPhone].' - '.$jsons[gpax].' - '.$jsons[school_id].' - '.$jsons[gradeID].' - '.$jsons[majorID].' - '.$jsons[minorID].' - '.$jsons[studentStatusCode].' - '.$jsons[studentStatusName]; echo '<br>'; echo"</font>"; // ������ SQL 㹡�� insert ŧ database insert("'$jsons[studentID]','$jsons[prefixID]','$jsons[idcard]','$jsons[firstname]','$jsons[surname]','$jsons[schoolName]','$jsons[studentCode]','$jsons[middlename]','$jsons[gender]','$jsons[firstnameEn]','$jsons[surnameEn]','$jsons[nickname]','$jsons[birthday]','$jsons[nationalityID]','$jsons[raceID]','$jsons[religionID]','$jsons[tel]','$jsons[fax]','$jsons[email]','$jsons[groupCode]','$jsons[groupName]','$jsons[groupAbbr]','$jsons[gradeNameTh]','$jsons[entranceDate]','$jsons[entranceYear]','$jsons[entranceSemester]','$jsons[studentStatusNameTh]','$jsons[retireYear]','$jsons[retireSemester]','$jsons[graduateDate]','$jsons[causeRetire]','$jsons[houseId]','$jsons[houseNumber]','$jsons[moo]','$jsons[soi]','$jsons[street]','$jsons[tumbolCode]','$jsons[zipCode]','$jsons[majorNameTh]','$jsons[minorNameTh]','$jsons[datasync_time]','$jsons[bloodName]','$jsons[parentPrefixId]','$jsons[parentFirstname]','$jsons[parentSurname]','$jsons[parentRelation]','$jsons[parentPhone]','$jsons[gpax]','$jsons[school_id]','$jsons[gradeID]','$jsons[majorID]','$jsons[minorID]','$jsons[studentStatusCode]','$jsons[studentStatusName]'","std2018_student"); } //���� update ������ insert("NULL,'1','$day_log'","regis_database_log"); ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.53 |
proxy
|
phpinfo
|
Settings