Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo '<meta charset="utf-8" />';
- include('../simplehtmldom/simple_html_dom.php');
- // -----------------------------------------------------------------------------
- // Retrieve the DOM from a given URL
- $html = file_get_html('http://ketquaxoso.24h.com.vn/xo-so-mien-bac/');
- $i=0;
- $timeupdate = array();
- foreach($html->find('span[style="font-size:14px; color:#fff; "]') as $e) {
- $timeupdate[$i++] = $e->innertext;
- }
- $i=0;
- $product = array();
- foreach($html->find('td[class="number_kq"]') as $e) {
- $product[$i++] = $e->innertext;
- }
- $response["detail"] = array();
- for ($i=0; $i < 5; $i++) {
- $kqmb["Time"]=$timeupdate[$i];
- $j=$i*8;
- $kqmb["DB"]=$product[$j++];
- $kqmb["G1"]=$product[$j++];
- $kqmb["G2"]=$product[$j++];
- $kqmb["G3"]=$product[$j++];
- $kqmb["G4"]=$product[$j++];
- $kqmb["G5"]=$product[$j++];
- $kqmb["G6"]=$product[$j++];
- $kqmb["G7"]=$product[$j++];
- array_push($response["detail"], $kqmb);
- }
- //$response["success"] = 1;
- // echoing JSON response
- echo json_encode($response);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment