-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuandurumu.php
executable file
·31 lines (31 loc) · 1.07 KB
/
puandurumu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require 'class.php';
$html = file_get_html('https://www.tff.org/Default.aspx?pageID=198');
$data = array();
$array = array();
foreach ( $html->find('#ctl00_MPane_m_198_10561_ctnr_m_198_10561_Panel1 > table > tr') as $element ) {
foreach ( $element->find('td') as $item ) {
$data[] = trim($item->plaintext);
}
}
for ( $i = 1; $i < count($data); $i++ ) {
if ( $i % 9 == 0 ) {
$team = explode('.', $data[$i], 2)[1];
$array_push = array(
'team' => $team,
'games' => $data[$i+1],
'wins' => $data[$i+2],
'draws' => $data[$i+3],
'losses' => $data[$i+4],
'goals_for' => $data[$i+5],
'goals_against' => $data[$i+6],
'goal_difference' => $data[$i+7],
'points_per_game' => $data[$i+8]
);
$array[] = $array_push;
}
}
$json = json_encode($array);
fopen('standings.json', 'w+');
file_put_contents('standings.json', $json);
?>