public function index() { $this->load->library('curl'); $this->curl->referer('www.goal.com/id-ID/'); $this->curl->userAgent('midp 2.0'); $html = $this->curl->openGet("http://www.goal.com/id-ID/"); $elements = array(); $this->load->helper('dom'); $dom = str_get_html($html); $needle = $dom->find('div[class=newsFeedList]', 0); foreach ($needle->find('li') as $li) { $time = $li->find('div[class=timestamp]', 0)->plaintext; $time = normalize_html($time); $a = $li->find('a', 0); $href = $this->normalize_href($a->href); $href = encode_href($href); $description = trim($a->innertext); $description = normalize_html($description); array_push($elements, array('name' => $time, 'description' => $description, 'value' => $href)); } $this->load->library('rafa'); $this->rafa->addHeading('goal'); $this->rafa->addList('news', $elements); $this->rafa->endRafa(); }
public function index() { $this->load->library('curl'); $this->curl->referer('m.detik.com/kanal/70/'); $this->curl->userAgent('midp 2.0'); $html = $this->curl->openGet("http://m.detik.com/kanal/70/"); $elements = array(); $this->load->helper('dom'); $dom = str_get_html($html); $needle = $dom->find('div[id=framehead]', 0); // parsing berita setelah headline foreach ($needle->find('div[class=nonhl]') as $h3) { $a = $h3->find('a', 0); $href = $this->normalize_href($a->href); $href = encode_href($href); $description = trim($a->innertext); $ipos = strpos($description, ' ', strpos($description, ' ') + 1); $name = $h3->find('span[class=date]', 0)->innertext; $description = normalize_html($description); array_push($elements, array('name' => $name, 'description' => $description, 'value' => $href)); } $this->load->library('rafa'); $this->rafa->addHeading('detikbola'); $this->rafa->addList('news', $elements); $this->rafa->endRafa(); }
public function index() { $this->load->library('curl'); $this->curl->referer('m.okezone.com'); $this->curl->userAgent('midp 2.0'); $html = $this->curl->openGet("http://m.okezone.com"); $elements = array(); $this->load->helper('dom'); $dom = str_get_html($html); // parsing berita headline for ($i = 0; $i < 2; $i++) { if ($headline = $dom->find('div[class=hl]', $i)) { $href = $headline->find('a', 0)->href; $href = $this->normalize_href($href); $href = encode_href($href); //echo $href; //die(); $judul3 = $headline->find('a', 0); $description = trim($judul3->plaintext); $description = normalize_html($description); $name = string_to_word($description, 3); array_push($elements, array('name' => $name, 'description' => $description, 'value' => $href)); } } // parsing berita setelah headline $ul = $dom->find('div[class=b]', 1); foreach ($ul->find('li') as $li) { $a = $li->find('a', 0); $href = $this->normalize_href($a->href); $href = str_replace('/', '.', $href); $description = trim($a->innertext); $description = normalize_html($description); $name = string_to_word($description, 3); array_push($elements, array('name' => $name, 'description' => $description, 'value' => $href)); } $this->load->library('rafa'); $this->rafa->addHeading('okezone'); $this->rafa->addList('news', $elements); $this->rafa->endRafa(); }