JavaScript
1
Вклад в тег
const deepClone = (obj) => {
let clone = {};
for (let prop in obj) {
if (typeof obj[prop] === 'object') {
clone[prop] = deepClone(obj[prop]);
} else {
clone[prop] = obj[prop];
}
}
return clone;
}
function getContent($url) {
$html = new simple_html_dom();
$html->load_file($url);
$html->save();
$table = $html->find('table.tb-matches');
foreach ($table as $key => $value) {
foreach ($value->find('tr') as $key => $tr) {
$elem = $tr->find('td', 0);
echo 'key' . $key . '<br>';
echo 'tr' . $tr . '<br>';
echo $tr->find('td', 0)->attr['colspan'] . '----<br>';
}
}
}
foreach ($dateArr as $key => $dateVal) {
getContent($url . $dateVal);
}
foreach ($dateArr as $key => $dateVal) {
$out .= file_get_contents($url . $dateVal) ;
}
$html = new simple_html_dom();
$html->load($out);
$html->save();
$table = $html->find('.list_table');
foreach ($table as $key => $value) {
$dd = $value->attr['date'];
foreach ($value->find('table.tb-matches tr') as $key => $tr) {
$elem = $tr->find('td', 0);
if ($elem->attr['colspan'] != '7') {
$resultArr[$dd][] = array(
'time' => $tr->find('td', 0)->plaintext,
'home_team' => $tr->find('td.home-team', 0)->plaintext,
'away_team' => $tr->find('td.away_team', 0)->plaintext,
'status' => trim($tr->find('td.status', 0)->plaintext),
'score' => $tr->find('td.score', 0)->plaintext,
'href' => 'http://goal24.ru' . $tr->find('td.option a', 0)->href,
);
}
}
}