Server IP : 103.233.192.212 / Your IP : 3.148.248.235 Web Server : Apache/2 System : Linux sv1.inde.co.th 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 User : sumpatuan ( 1058) PHP Version : 5.5.38 Disable Function : symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,putenv,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sumpatuan/domains/sumpatuan.go.th/public_html/main/ |
Upload File : |
<?php require_once('db_main.php'); header('Content-Type: text/html; charset=UTF-8'); $deptsubid = "6730314"; $catType = array('P0', '15', 'B0', 'D0', 'W0', 'D1', 'W1', 'D2', 'W2'); date_default_timezone_set('Asia/Bangkok'); $begintime1 = strtotime("12:01:01"); $endtime1 = strtotime("12:59:00"); $begintime2 = strtotime("17:01:01"); $endtime2 = strtotime("24:00:00"); $begintime3 = strtotime("00:00:01"); $endtime3 = strtotime("08:59:59"); $now = time(); if (($now >= $begintime1 && $now <= $endtime1) || ($now >= $begintime2 && $now <= $endtime2) || ($now >= $begintime3 && $now <= $endtime3)) { $i = 0; foreach ($catType as $newsType) { $url = "http://process3.gprocurement.go.th/EPROCRssFeedWeb/egpannouncerss.xml?deptId=".$deptsubid."&anounceType=".$newsType; // echo $url; // echo '<br>'; libxml_use_internal_errors(true); $doc = simplexml_load_string(file_get_contents($url)); // print_r($doc); // echo '<br><br>'; if ($doc === false) { echo "<SCRIPT type='text/javascript'> alert('ดึงข้อมูล ประกาศจัดซื้อจัดจ้างจากระบบ e-GP ไม่สำเร็จ! เนื่องจากระบบดึงข้อมูลล่ม กรุณาลองอีกครั้ง'); window.location.replace('index'); </SCRIPT>"; exit; // libxml_clear_errors(); // libxml_use_internal_errors($doc); } else { $items = $doc->xpath("/rss/channel/item"); foreach ($items as $item) { $sql1 = " SELECT * FROM `data_egp` WHERE TRIM(`detail_egp`)=TRIM('$item->link') AND `alias_egp`='$newsType' "; $result1 = $con_db_main->query($sql1); $numrows = $result1->num_rows; // if(!$numrows) { $title_egp = trim($item->title); $detail_egp = trim($item->link); $datetime_egp = trim($item->pubDate); $sql2 = " INSERT INTO `data_egp` ( `title_egp`, `detail_egp`, `alias_egp`, `datetime_egp` ) VALUES ( '$title_egp', '$detail_egp', '$newsType' , '$datetime_egp' ) "; $query2 = $con_db_main->query($sql2); } $i++; } } } echo "<SCRIPT type='text/javascript'> alert('ดึงข้อมูล ประกาศจัดซื้อจัดจ้างจากระบบ e-GP สำเร็จ!'); window.location.replace('index'); </SCRIPT>"; exit; }else{ echo "<SCRIPT type='text/javascript'> alert('ระบบ e-GP ปิดระบบให้ดึงข้อมูลในช่วงเวลานี้ กรุณาลองอีกครั้ง ในช่วงเวลาที่เปิดดึงข้อมูล ( เปิดช่วงเวลา 12.01 - 12.59 น. และ 17.01 - 08.59 น. ของทุกวัน )'); window.location.replace('index'); </SCRIPT>"; exit; } ?>