| Server IP : 103.48.194.25 / Your IP : 216.73.216.242 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hocthongminh.net-bk/public_html/webadmin/components/robot/controllers/ |
Upload File : |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class getcontent extends CI_Controller
{
protected $_admin_id;
public $_module_name = "";
function __construct()
{
parent::__construct();
$this->pre_message = "";
$this->_module_name = $this->router->fetch_module();
$this->permit_library->check_permit(1);
$this->session->set_userdata(array('Url'=>uri_string()));
//$this->load->model('cauhinh_model','cauhinh');
$this->load->model('getcontent_model','getcontent');
$this->load->library('robot');
$this->load->library('crawl');
$this->load->helper('auto') ;
$this->load->helper('mail');
}
//lay nguyen dong may theo ronot edit
function index($robot_id=0)
{
$rs = $this->getcontent->get_record("auto_config","robot_id",$robot_id); //trit($rs);
if($rs)
{
$config_node = split_config($rs->rule_list) ; //trit($config_node);
$k = 0 ;
for($i=1;$i<=$rs->field_name;$i++)
{
$links = $rs->robot_url."&page=".$i ;
$html = $this->crawl->getHTML($links); //var_dump($html); die();
$arr_content = $this->crawl->getNodes($html,$config_node[0]);
foreach($arr_content as $content) :
$arr = split_node($content, 'li');
$req = $this->built_form($arr,$rs->catid,$rs->trade_id,$rs->modern_id, $k);
$id = $this->getcontent->save("errcode",$req) ;
$k = $k+1 ;
endforeach ;
}
}
redirect('robot/cauhinh/index');
}
function built_form($arr,$catid,$tradeid,$modern_id,$i=0)
{
$arr[3] = isset($arr[3])? $arr[3] : '';
$req['nb_order'] = $i ;
$req['err_code'] = str_replace('<span class="ercH">Code: </span>','',$arr[0]) ;
$req['lb_title'] = strip_tags($arr[0]) ;
$req['lb_display'] = $arr[0] ;
$req['lb_desc'] = trim(str_replace('<span class="ercH">Description: </span>','',$arr[1])) ;
$req['lb_causes'] = trim(str_replace('<span class="ercH">Causes: </span>','',$arr[2])) ;
$req['lb_remedy'] = trim(str_replace('<span class="ercH">Remedy: </span>','',$arr[3])) ;
$req['cat_id'] = $catid ;
$req['tradeid'] = $tradeid ;
$req['modern_id'] = $modern_id ;
$req['dt_create'] = date("Y-m-d H:i:s") ;
$req['dt_modify'] = date("Y-m-d H:i:s") ;
$req['bl_active'] = 1 ;
return $req;
}
/*function index($robot_id=0)
{
$rs = $this->getcontent->get_record("auto_config","robot_id",$robot_id); //trit($rs);
if($rs)
{
$config_node = split_config($rs->rule_list) ;
$filename = ROOT."temp/1.html";
$arr_content = getContent($filename,$config_node[0]); //trit($arr_content);
$i = 0 ;
foreach($arr_content as $content) :
$arr = split_node($content, 'li');
$req = $this->built_form($arr,$rs->catid,$rs->trade_id,$rs->modern_id, $i); //trit($req);
$id = $this->getcontent->save("errcode",$req) ;
$i = $id ;
endforeach ;
}
redirect('robot/cauhinh/index');
}*/
function success()
{
$data['title'] = "Cập nhật thành công" ;
$data['page'] = "success" ;
$this->load->view("layout/skin", $data);
}
}
?>