| | |
| | | // Lista gier. |
| | | protected $gry = array( |
| | | // nazwa => array(ilość liczb, plus?) |
| | | 'lotto' => array(6, FALSE), |
| | | 'mini-lotto' => array(5, FALSE), |
| | | 'kaskada' => array(12, FALSE), |
| | | 'multi-multi' => array(20, TRUE), |
| | | 'joker' => array(5, FALSE) |
| | | 'lotto' => array(6, FALSE, 'dl'), |
| | | 'mini-lotto' => array(5, FALSE, 'el'), |
| | | 'kaskada' => array(12, FALSE, 'ka'), |
| | | 'multi-multi' => array(20, TRUE, 'mm'), |
| | | 'joker' => array(5, FALSE, 'jk') |
| | | ); |
| | | |
| | | // Spróbuj pobrać stronę http://lotto.pl/wyniki-gier |
| | |
| | | |
| | | return $wyniki; |
| | | } |
| | | |
| | | function pobierz() { |
| | | foreach($this->gry as $gra => $data) { |
| | | echo STAR.'Wyniki gry '.$gra.'...'; |
| | | if($gra == 'multimulti') { |
| | | $wyniki = $this->wyniki($gra, 2); |
| | | $wynik = $wyniki[0]; |
| | | $skrot = $data[2].substr($wynik['godzina'], 0, 2); |
| | | $last_data = @file_get_contents('./last_'.$skrot.'.txt'); |
| | | if($last_data != $wynik['data']) { |
| | | $output = array(); |
| | | $output['data'] = $wynik['data']; |
| | | for($i = 0; $i < $data[0]; $i++) { |
| | | $output[$i+1] = $wynik['liczby'][$i]; |
| | | } |
| | | if($data[1]) { |
| | | $output['plus'] = $wynik['plus']; |
| | | } |
| | | file_put_contents('./last_'.$skrot.'.txt', $output['data']); |
| | | file_put_contents('./'.$skrot.'.txt', serialize($output)); |
| | | file_put_contents('./archiwum/'.$skrot.'_'.date('j.m.Y', strtotime($output['data'])).'.txt', serialize($output)); |
| | | } |
| | | |
| | | $wynik = $wyniki[1]; |
| | | $skrot = $data[2].substr($wynik['godzina'], 0, 2); |
| | | $last_data = @file_get_contents('./last_'.$skrot.'.txt'); |
| | | if($last_data != $wynik['data']) { |
| | | $output = array(); |
| | | $output['data'] = $wynik['data']; |
| | | for($i = 0; $i < $data[0]; $i++) { |
| | | $output[$i+1] = $wynik['liczby'][$i]; |
| | | } |
| | | if($data[1]) { |
| | | $output['plus'] = $wynik['plus']; |
| | | } |
| | | file_put_contents('./last_'.$skrot.'.txt', $output['data']); |
| | | file_put_contents('./'.$skrot.'.txt', serialize($output)); |
| | | file_put_contents('./archiwum/'.$skrot.'_'.date('j.m.Y', strtotime($output['data'])).'.txt', serialize($output)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $wynik = $this->wynik($gra); |
| | | $skrot = $data[2]; |
| | | $last_data = @file_get_contents('./last_'.$skrot.'.txt'); |
| | | if($last_data != $wynik['data']) { |
| | | $output = array(); |
| | | $output['data'] = $wynik['data']; |
| | | for($i = 0; $i < $data[0]; $i++) { |
| | | $output[$i+1] = $wynik['liczby'][$i]; |
| | | } |
| | | if($data[1]) { |
| | | $output['plus'] = $wynik['plus']; |
| | | } |
| | | file_put_contents('./last_'.$skrot.'.txt', $output['data']); |
| | | file_put_contents('./'.$skrot.'.txt', serialize($output)); |
| | | file_put_contents('./archiwum/'.$skrot.'_'.date('j.m.Y', strtotime($output['data'])).'.txt', serialize($output)); |
| | | } |
| | | } |
| | | echo OK; |
| | | } |
| | | } |
| | | } |
| | | |
| | | $lotto = new lotto(); |