Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'http://www.idx.co.id/Home/ListedCompanies/Announcement/tabid/92/language/id-ID/Default.aspx';
- include('simple_html_dom.php');
- $html = new simple_html_dom();
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
- curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
- $html->load(curl_exec($ch));
- curl_close($ch);
- $articles = array();
- foreach($html->find('div[class="tempat_list_berita"]') as $str) {
- $str = preg_replace("/\n+/","",$str);
- $str = preg_replace("/<br>/"," ",$str);
- $str = preg_replace("/\s+/"," ",$str);
- preg_match_all('/<span id="dnn_ctr519_MainView_rl1_ctrl[0-9]_lblDate">(.*?)<\/span>/si', $str, $tgl);
- preg_match_all('/style="color:#760605;font-size:12px;font-weight:bold;">(.*?)<\/a>/si', $str, $headline);
- $i = 0;
- foreach( $tgl[1] as $tanggal ) {
- $item = array();
- $item['date'] = $tanggal;
- $item['headline'] = $headline[1][$i];
- $articles[] = $item;
- $i++;
- }
- }
- echo "<pre>\n";
- print_r($articles);
- echo "</pre>\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment