Yapmanız gereken Bu adresten simple html dom indirmek

<?php

const BASE_URL = "https://www.tjk.org";
$data = [];
function today(): array
{
include_once '../simple_html_dom.php';
$ch = curl_init(BASE_URL . "/TR/YarisSever/Info/data/GunlukYarisProgrami");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true
]);
$result = curl_exec($ch);
curl_close($ch);
$arr = [];
$dom = new simple_html_dom();
$dom->load($result);
$sehirId = 'data-sehir-id';

$ul = $dom->find(".gunluk-tabs > li");
foreach ($ul as $item) {
$a = $item->find("a");
$arr[] = [
'link' => html_entity_decode($a[0]->href),
'name' => html_entity_decode($a[0]->plaintext),
'sehirId' => $a[0]->$sehirId,
'sehir' => $a[0]->id
];
}
return $arr;
}

function getRace($link): array
{
include_once '../simple_html_dom.php';
$ch = curl_init(BASE_URL . $link);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true
]);
$result = curl_exec($ch);
curl_close($ch);
$dom = new simple_html_dom();
$dom->load($result);

$races = [];
$getBonus = function ($dl) use ($dom)
{
$dtArr = [];
$ddArr = [];
$dt = $dl->find("dt");
$dd = $dl->find("dd");
foreach ($dt as $item) {
$dtArr[] = rtrim($item->plaintext, '.)');
}
foreach ($dd as $item) {
$ddArr[] = str_replace([' ', 't', '$'], ['', ' ', ' $'], $item->plaintext);
}
return array_combine($dtArr, $ddArr);
};
$racesTabs1 = $dom->find("ul.races-tabs a[sehir]");
$hava = $dom->find(".conditions-race");
$hava = preg_replace('@\s+(.*\d+)\s+.*@', '$1', $hava[0]->plaintext);
$races['hava'] = isset($dom->find(".raceWeatherGreen")[0]->plaintext) ? html_entity_decode(preg_replace("/\s+/", ' ', $hava)) : null;
foreach ($racesTabs1 as $item) {
$bonus = [];
$kosuBilgisi = [];
$info = preg_replace("/\s+(\d+.*\w+)\s+(\d+:\d+)\s+/", '$1 | $2', $item->plaintext);
$id = strtok($item->id, 'anc');
$main = $dom->find("#$id");
$aciklama = $main[0]->find(".aciklamaFancy")[0]->title;
$cnf = preg_replace("/\s+/", ' ', $main[0]->find(".race-config")[0]->plaintext);
$eid = $main[0]->find(".race-config")[0]->find("a[title*='derece']");
$yarisBittiMi = false;

$shareDiv = $main[0]->find(".race-share");
$dl = $shareDiv[0]->find("h3");

$tablo = $main[0]->find("#kosubilgisi-" . $id . " tbody tr");
foreach ($tablo as $k => $v) {
$atAdi = $v->find(".gunluk-GunlukYarisProgrami-AtAdi a:not(.tooltiptextt)");
$atAdi = !count($atAdi) ? $v->find(".gunluk-GunlukYarisProgrami-AtAdi")[0]->innertext : $atAdi[0]->innertext;
$atAdi = trim(preg_replace("/<a .*?\">(.*?)<spa.*/", '$1', $atAdi));
$atAdi = trim(preg_replace("/<spa.*/", '', $atAdi));
$sonucSiralama = $v->find(".gunluk-GunlukYarisProgrami-AtAdi a span");
$sonucSiralama = !count($sonucSiralama) ? $v->find(".gunluk-GunlukYarisProgrami-AtAdi span")[0]->plaintext : $sonucSiralama[0]->plaintext;
if (strpos($atAdi, 'Koşmaz'))
$sonucSiralama = 'Koşmaz';
$yarisBittiMi = (bool)strlen(trim($sonucSiralama));
$jokey = $v->find(".gunluk-GunlukYarisProgrami-JokeAdi a");
$jokey = !count($jokey) ? $v->find(".gunluk-GunlukYarisProgrami-JokeAdi")[0]->plaintext: $jokey[0]->plaintext;
$sahip = $v->find(".gunluk-GunlukYarisProgrami-SahipAdi a");
$sahip = !count($sahip) ? $v->find(".gunluk-GunlukYarisProgrami-SahipAdi")[0]->plaintext : $sahip[0]->plaintext;
$antrenor = $v->find(".gunluk-GunlukYarisProgrami-AntronorAdi a");
$antrenor = !count($antrenor) ? $v->find(".gunluk-GunlukYarisProgrami-AntronorAdi span")[0]->plaintext : $antrenor[0]->plaintext;
$kosuBilgisi[$k] = [
'siraId' => preg_replace("/\s+/", '', $v->find(".gunluk-GunlukYarisProgrami-SiraId")[0]->plaintext),
'atAdi' => $atAdi,
'sonucSiralama' => preg_replace("/\s+|\((\d+)\)/", '$1', $sonucSiralama),
'kilo' => trim(preg_replace("/\s+(\d+)(\+.*\.\d+)?.*/", "$1 $2", $v->find(".gunluk-GunlukYarisProgrami-Kilo")[0]->plaintext)),
'yas' => trim(preg_replace("/\s+/", " ", $v->find(".gunluk-GunlukYarisProgrami-Yas")[0]->plaintext)),
'jokey' => trim(preg_replace("/\s+/", ' ', $jokey)),
'sahip' => html_entity_decode(trim(preg_replace("/\s+/", ' ', $sahip))),
'antrenor' => trim(preg_replace("/\s+/", ' ', $antrenor)),
'startNo' => trim(preg_replace("/\s+|(?:<sup.*(DS).*)?/", "$1", $v->find(".gunluk-GunlukYarisProgrami-StartId")[0]->innertext)),
'handikap' => preg_replace("/\s+/", "", $v->find(".gunluk-GunlukYarisProgrami-Hc")[0]->plaintext),
'son6Yaris' => preg_replace("/\s+/", " ", $v->find(".gunluk-GunlukYarisProgrami-Son6Yaris")[0]->innertext),
'kgs' => preg_replace("/\s+/", "", $v->find(".gunluk-GunlukYarisProgrami-KGS")[0]->plaintext)
];
}


foreach ($dl as $v) {
if (strlen(trim($v->plaintext))) {
$bonus[str_replace(' ', '_', mb_strtolower(trim($v->plaintext, ': ')))] = $getBonus($v->next_sibling());
}
}
$explode = explode(" | ", $info);
$races['yarislar'][$explode[0]] = [
'saat' => $explode[1],
'id' => ltrim($id, '-'),
'yaris_bitti_mi' => $yarisBittiMi,
'aciklama' => html_entity_decode($aciklama),
'cnf' => html_entity_decode($cnf),
'en_iyi_derece_aciklama' => count($eid) ? $eid[0]->title : null,
'paralar' => $bonus,
'kosu_bilgisi' => $kosuBilgisi,
];
}
return $races;
}

foreach (today() as $item) {
$data[$item['sehir']] = getRace($item['link']);
}

print_r($data);