
<html>
    
    <head>
        
        <style>
            .td{
                
                
            }
            .table {
    --bs-table-color: var(--bs-body-color);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--bs-border-color);
    --bs-table-accent-bg: transparent;
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-striped-bg: rgba(0, 0, 0, 0.05);
    --bs-table-active-color: var(--bs-body-color);
    --bs-table-active-bg: rgba(0, 0, 0, 0.1);
    --bs-table-hover-color: var(--bs-body-color);
    --bs-table-hover-bg: rgba(0, 0, 0, 0.075);
    width: 100%;
    margin-bottom: 1rem;
    color: var(--bs-table-color);
    vertical-align: top;
    border-color: var(--bs-table-border-color);
}
       @media (max-width: 1199.98px) {
    .table-responsive-xl {
        display:block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: -ms-autohiding-scrollbar
    }

    .table-responsive-xl>.table-bordered {
        border: 0
    }
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar
}

.table-responsive>.table-bordered {
    border: 0
}

.form-control {
    display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out
}
body{
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: left;
}
     
        </style>
    </head>

<body>
<?php
$url = 'https://tabelkinjit.com/data-hk/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($ch);
curl_close($ch);

$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html);
libxml_use_internal_errors(false);

$xpath = new DOMXPath($doc);
$table = $xpath->query('//table[@class="table table-dark table-striped table-hover table-bordered"]')->item(0);

if ($table) {
    echo '<table class="table table-striped" style="color: #fff;background-color: #212529;">';
    echo '<thead>';
    echo '<tr style="border: 1px solid #dee2e6;padding:1rem;border-color: #32383e;font-family:Helvetica;">';
    echo '<th>HARI &amp; TANGGAL</th>';
    echo '<th class="d-none d-sm-table-cell">PERIODE</th>';
    echo '<th style="min-width: 120px;">HASIL HK POOLS</th>';
    echo '</tr>';
    echo '</thead>';

    $cellCount = 0;
    $cellValues = array();
    foreach ($table->getElementsByTagName('tr') as $row) {
        foreach ($row->getElementsByTagName('td') as $cell) {
            $cellValues[] = $cell->nodeValue;
        }
    }

    $rowCount = 0;
    echo '<tr>';
    foreach ($cellValues as $key => $value) {
        $cellCount++;
        if ($cellCount % 4!== 0) {
            echo '<td class="text-secondary" style="border: 1px solid #dee2e6;padding:.75rem;border-color: #32383e;font-family:Helvetica;">'. $value. '</td>';
            $rowCount++;
            if ($rowCount == 3) {
                echo '</tr><tr>';
                $rowCount = 0;
            }
        }
    }
    echo '</tr>';

    echo '</table>';
} else {
    echo 'Table not found.';
}
	?>
	</body>
	
	</html>

