Скачиваний:
17
Добавлен:
27.11.2024
Размер:
2 Кб
Скачать

<table class="table table-condensed table-striped">
            <thead>
            <tr>

                <th>Позиция</th>
                <th>Сайт</th>
				<th>Страна</th>
                <th>Система</th>
				<th>Производитель</th>
                <th>Ядра</th>
                
                    <th>Rmax (TFlop/s)</th>
                    <th>Rpeak (TFlop/s)</th>
                
                <th>Power (kW)</th>
            </tr>
            <thead>
<?php  
for ($a = 1; $a ; $a++){
	if ($a > 5) {
		
		break;
	}


$url = "https://www.top500.org/list/2018/11/?page=".$a;
    $url = file_get_contents($url);
$html = $url;
 
$start_table = '</thead>';
 
$end_table = "</table>";
 
$start = strpos($html, $start_table);
$end = strpos($html, $end_table);
$result[$a] = substr($html, $start - 1, $end - $start - 1);
 
$result[$a] = preg_replace('/<br.*?>/','</td><td>', $result[$a]); 
$result[$a] = preg_replace('/<a href="/', '<a href="https://www.top500.org',$result[$a]);
$result[$a] = preg_replace("/<a.+href=\"(.*?)\">\s*?(.*?)\s*?<\/a>/","$1", $result[$a]); 
$result[$a] = preg_replace('/<span>(.*?)<\/span>/','$1', $result[$a]);



}

$full_result = $result[1] . $result[2] . $result[3] . $result[4] . $result[5];


$full_result = preg_replace("/<a.+href=\"(.*?)\">\s*?(.*?)\s*?<\/a>/","$1", $full_result);  

echo $full_result;
$vivod = '<table class="table table-condensed table-striped">
            <thead>
            <tr>

                <th>Позиция</th>
                <th>Сайт</th>
				<th>Страна</th>
                <th>Система</th>
				<th>Производитель</th>
                <th>Ядра</th>
                
                    <th>Rmax (TFlop/s)</th>
                    <th>Rpeak (TFlop/s)</th>
                
                <th>Power (kW)</th>
            </tr>
            <thead>' . $full_result . '
</tbody></table>';

file_put_contents('top500-rank.html',$vivod);
?>

</tbody></table>
Соседние файлы в папке parser-php