Uncategorised

$depid = "5520801"; $aType = array('P0', '15', 'B0', 'D0', 'W0', 'D1', 'W1', 'D2', 'W2'); $aCat = array(11, 12, 13, 14, 15, 16, 17, 18, 19); //รหัสหมวดหมู่ สำหรับแยกประเภทประกาศ anounceType 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 ($aType as $newsType) { //ประเภทประกาศ $url = "http://process3.gprocurement.go.th/EPROCRssFeedWeb/egpannouncerss.xml?deptId=" . $depid . "&anounceType=" . $newsType; libxml_use_internal_errors(true); $doc = simplexml_load_string(file_get_contents($url)); if ($doc === false) { libxml_clear_errors(); libxml_use_internal_errors($doc); } else { $items = $doc->xpath("/rss/channel/item"); foreach ($items as $item) { $db = & JFactory::getDBO(); $sql = "SELECT * FROM #__content WHERE `introtext` LIKE '%" . TRIM($item->link) . "%' AND catid = " . $aCat[$i]; $db->setQuery($sql); $db->query(); if (!$db->getNumRows()) { $item_title = $item->title; $item_alias = preg_replace("/\s+/", "_", $item_title); $item_content = "link) . "\" targer=\"_blank\">\"Readmore?\""; $article['title'] = $item_title; $article['alias'] = $item_alias; $article['introtext'] = $item_content; $article['catid'] = $aCat[$i]; $article['created'] = JFactory::getDate()->format('Y-m-d-H-i-s'); $article['created_by_alias'] = 'Super User'; $article['state'] = 1; $article['access'] = 1; $article['metadata'] = '{"page_title":"","author":"","robots":""}'; $article['language'] = '*'; if (version_compare(JVERSION, '3.0', 'lt')) { JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table'); } $table = JTable::getInstance('Content', 'JTable', array()); $table->bind($article); $table->check(); $store = $table->store(); if ($store == true) { $db = & JFactory::getDBO(); $sql = "UPDATE #__content SET `title`='" . $item_title . "' WHERE id = " . $table->id; $db->setQuery($sql); $db->query(); } } } $i++; } } } else { } //********************************//

 

 

-  อยู่ระหว่างดำเนินการ -

จำนวนผู้เยี่ยมชม

วันนี้ 29

วันนี้ 21

สัปดาห์นี้ 205

เดือนนี้ 179

รวม 40023

Currently are 15 guests and no members online

Kubik-Rubik Joomla! Extensions

มี 255 ผู้มาเยือน และ ไม่มีสมาชิกออนไลน์ ออนไลน์