Example #1
0
    $FileName = $Lines . "league.html";
    if (!file_exists($FileName)) {
        $Html = download("{$Host}/bets.php?line_id[]={$Sport}", "GET", "{$Host}/center.php");
        file_put_contents($FileName, $Html);
    } else {
        $Html = file_get_contents($FileName);
    }
} else {
    $Html = download_page("{$Host}/bets.php?line_id[]={$Sport}", "GET", "{$Host}/center.php");
}
function extract_league($Html)
{
    $Html = replace_all($Html, '<table', '</table>', '', 'долгосрочные ставки');
    return extract_form_hash($Html);
}
$Form = copy_be(win1251_to_utf8($Html), '<form id="fbets"', '</form>');
if ($debug) {
    file_put_contents($Lines . "form.txt", $Form);
}
$PostHash = extract_league($Form);
$FormAction = extract_form_action($Form);
if ($debug) {
    file_put_contents($Lines . "league.txt", implode_hash("\r\n", $PostHash));
}
// Получаем перечень турниров
$PostHash['simple'] = 'on';
if ($debug) {
    $FileName = $Lines . "bets.html";
    if (!file_exists($FileName)) {
        $Html = download("{$Host}/{$FormAction}", "POST", "{$Host}/bets.php?line_id[]={$Sport}", $PostHash);
        file_put_contents($FileName, $Html);
Example #2
0
function convert_to_utf8($Html)
{
    if (stripos($Html, 'charset=windows-1251') !== false) {
        $Html = win1251_to_utf8($Html);
        $Html = str_ireplace('charset=windows-1251', 'charset=utf-8', $Html);
    }
    return $Html;
}
Example #3
0
    $Html = copy_be($Html, '<form ', '</form>', '"frmTurnirs"');
    $Html = extract_tags($Html, '<input', '>', "\r\n", 'id="sport_', 'name="turnir_');
    $Html = delete_all($Html, '<input', '>', 'turnir_2_');
    // Бейсбол
    $Html = delete_all($Html, '<input', '>', 'turnir_12_');
    // Бокс
    $Html = delete_all($Html, '<input', '>', 'turnir_254_');
    // Лотереи
    $Html = delete_all($Html, '<input', '>', 'turnir_255_');
    // Другие виды спорта
    $Html = delete_all($Html, '<input', '>', 'turnir_6_');
    // Хоккей
    $Html = extract_property_values($Html, 'name', ';');
    return $Html;
}
$LeagueList = extract_league(win1251_to_utf8($Html));
if ($debug) {
    file_put_contents($Lines . "league.txt", $LeagueList);
}
function extract_bet($Html)
{
    $Html = kill_tag_bound($Html, 'b|a|font|img');
    $Html = str_ireplace('\'style', '\' style', $Html);
    $Html = str_ireplace('nowrap', '', $Html);
    $Html = kill_space($Html);
    $Html = numbering_tag($Html, 'table');
    $Html = extract_numbered_tags($Html, 'table', "\r\n", 'width=\'70%\'');
    $Html = kill_property($Html, "onmousemove|onmouseout|valign|align|class|style|height|width|cellpadding|cellspacing|border");
    $Html = kill_property($Html, 'TagNo');
    // раскрываем таблицы в дате и заголовках
    for ($i = 2; $i < 20; $i++) {
Example #4
0
 public function getEvents($sport_id, $tournir_id, $tournir_url)
 {
     $xml = parent::getEvents($sport_id, $tournir_id, $tournir_url);
     $tournir_node = $xml->addChild('Events');
     $file_name = $this->league_path . $tournir_id;
     $rnd = rand(1000000000, 2000000000);
     $url = $this->host . "/bets/bets2.php?rnd={$rnd}";
     $referer = $this->host . (string) $this->sport_node['Url'];
     $post_hash['time'] = 1;
     $post_hash['gcheck'] = 9;
     $post_hash['line_id[]'] = $tournir_id;
     $html = download_or_load($this->debug, $file_name . ".html", $url, "POST", $referer, $post_hash);
     $this->extract_events($tournir_node, win1251_to_utf8($html), (string) $this->sport_node['Sign'], $tournir_id);
     if ($this->debug) {
         file_put_contents($file_name . ".xml", $xml->asXML());
     }
     return $xml;
 }