function olymp_get_tournirs(&$sport_node, $sport_sign, $debug = null) { $host = 'https://olympbet.com'; $booker = 'olymp'; if (file_exists('proxy.txt')) { $proxy = file_get_contents('proxy.txt'); } $league_path = "lines/{$booker}/{$sport_sign}."; // получаем перечень турниров $file_name = $league_path . "league.html"; $html = download_or_load($debug, $file_name, "{$host}/{$sport_sign}-odds.html", "GET", $proxy, ""); extract_league($sport_node, $html); if ($debug) { file_put_contents($league_path . "league.xml", $sport_node->asXML()); } }
} 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); } else { $Html = file_get_contents($FileName); } } else {
$Html = implode(",", $Matches[1]); return $Html; } // Получаем перечень турниров if ($debug) { $FileName = $Leagues . "league.html"; if (!file_exists($FileName)) { $Html = download("https://www.bwin.com/{$Sport}?ShowDays=168", "GET"); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } } else { $Html = download("https://www.bwin.com/{$Sport}?ShowDays=168", "GET"); } $LeagueList = extract_league(utf8_to_ansi_ru(utf8_to_ansi_ce($Html))); if ($debug) { file_put_contents($Leagues . "league.txt", $LeagueList); } function extract_bet($Html) { $Html = delete_all($Html, "(at ", ")"); $Html = delete_all($Html, "(score: ", ")"); $Html = str_ireplace('<wbr/>', '', $Html); $Html = str_replace("-.--", " ", $Html); $Html = kill_tag($Html, "h1|script"); $Html = kill_space($Html); $Html = kill_comment($Html); $Html = numbering_tag($Html, 'div'); $Html = extract_numbered_tags($Html, 'div', "", "bet-list"); $Html = extract_numbered_tags($Html, 'div', "", "dsBodyContent");
$Html = str_ireplace("showrosp=1\r\n", '', $Html); return $Html; } // Получаем перечень турниров if ($debug) { $FileName = $Lines . "league.html"; if (!file_exists($FileName)) { $Html = download("http://favoritbet.com/ru/bet/{$SportId}/", "GET"); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } } else { $Html = download("http://favoritbet.com/ru/bet/{$SportId}/", "GET"); } $Leagues = extract_league(utf8_to_ansi_ru($Html)); if ($debug) { file_put_contents($Lines . "league.txt", $Leagues); } if ($Leagues == '') { exit; } function extract_bet($Html) { $Html = kill_space($Html); $Html = numbering_tag($Html, 'table'); $Html = extract_numbered_tags($Html, 'table', '', 'content'); $Tags = explode("\r\n", extract_tags($Html, '<table', 'height="22"', "\r\n")); foreach ($Tags as $tag) { $TagNo = extract_tagno($tag, 'table'); $Table = extract_numbered_tag($Html, 'table', $TagNo);
$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++) {
} else { $Html = file_get_contents($FileName); } $FileName = $Lines . "sport.txt"; file_put_contents($FileName, extract_sport($Html)); // Получаем перечень турниров $FileName = $Lines . "league.html"; if (!file_exists($FileName)) { $PostData = explode("\r\n", file_get_contents($Lines . "sport.txt")); $Html = download_page("http://www.betcity.ru/bets.php", "POST", "http://www.betcity.ru/main2.php", implode('&', $PostData)); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } $FileName = $Lines . "league.txt"; file_put_contents($FileName, extract_league($Html)); // Получаем перечень ставок $FileName = $Lines . "bets.html"; if (!file_exists($FileName)) { $PostData = explode("\r\n", file_get_contents($Lines . 'league.txt')); $Html = download_page("http://www.betcity.ru/bets2.php", "POST", "http://www.betcity.ru/bets.php", implode('&', $PostData)); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } $FileName = $Lines . 'bets.txt'; file_put_contents($FileName, extract_bet($Html)); print file_get_contents($FileName); ?>
$Html = delete_all($Html, '<input', '>', 'turnir_255_'); // Другие виды спорта $Html = delete_all($Html, '<input', '>', 'turnir_6_'); // Хоккей $Html = extract_property_values($Html, 'name', ';'); return $Html; } // Получаем перечень турниров $FileName = $Lines . "league.html"; if (!file_exists($FileName)) { $Html = download("http://bet.by/lines_set_turnir.php?period=all", "GET", "http://bet.by/"); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } $LeagueList = extract_league($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++) {
$Html = str_ireplace("' value='", "=", $Html); return $Html; } // Получаем перечень турниров if ($debug) { $FileName = $Lines . "league.html"; if (!file_exists($FileName)) { $Html = download_page("http://plusminus1.com/bet.php?events={$Sport}", "GET"); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } } else { $Html = download_page("http://plusminus1.com/bet.php?events={$Sport}", "GET"); } $Leagues = extract_league($Html); if ($debug) { file_put_contents($Lines . "league.txt", $Leagues); } function extract_bet($Html) { $Html = copy_be($Html, '<form ', '</form>', 'betform'); $Html = kill_tag($Html, 'script|div'); $Html = kill_space($Html); $Html = kill_tag_bound($Html, 'b|span|br|i|a|input|font|img'); $Html = delete_all($Html, '<tr', '</tr>', 'line3'); $Html = kill_property_value_exclude($Html, 'class', 'line_table'); $Html = kill_property($Html, 'width|height|valign|align|bgcolor|style|border|cellspacing|cellpadding'); // Убираем "левые" данные $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'Хозяева|' . 'Гости|' . 'Индив.тотал:|' . '-я четверть|' . '-я партия|' . ' тайм|' . '-й сет'); return $Html;
$Html = str_ireplace("'", '', $Html); return $Html; } // Получаем перечень турниров if ($debug) { $FileName = $Leagues . "league.html"; if (!file_exists($FileName)) { $Html = download("http://bet-at-home.com/tree.aspx", "GET", "http://bet-at-home.com/start.aspx"); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } } else { $Html = download("http://bet-at-home.com/tree.aspx", "GET", "http://bet-at-home.com/start.aspx"); } $LeagueList = extract_league(utf8_to_ansi_ce($Html), $Sport); if ($debug) { file_put_contents($Leagues . "league.txt", $LeagueList); } if ($LeagueList == '') { exit; } $Html = download("http://bet-at-home.com/odd.aspx?action=addSport&SportID={$Sport}", "GET", "http://bet-at-home.com/tree.aspx"); function extract_bet($Html) { $Html = str_ireplace(' nowrap', ' ', $Html); $Html = kill_space($Html); $Html = kill_comment($Html); $Html = extract_tags($Html, '<table ', '</table>', "\r\n", 'class="OT"'); $Html = kill_tag($Html, "script"); $Html = kill_tag_bound($Html, "form|input|a|nobr|img|tbody|div");
$xml = new SimpleXMLElement("<Scan/>"); $xml->addAttribute('id', $ScanId); function extract_league($Html) { global $xml; $Html = extract_tags($Html, '<a href=\'betsnew.aspx?leagueids=', '>', "\r\n"); preg_match_all('/(\\d+)/m', $Html, $Matches); foreach ($Matches[1] as $league_id) { $xml->addChild('Tournir', $league_id); } } // Получаем перечень турниров if ($debug) { $FileName = $Leagues . "league.html"; if (!file_exists($FileName)) { $Html = download_curl("{$Host}/{$Sport}?ShowDays=168", "GET", $Proxy); file_put_contents($FileName, $Html); } else { $Html = file_get_contents($FileName); } } else { $Html = download("{$Host}/{$Sport}?ShowDays=168", "GET", $Proxy); } extract_league($Html, $xml); if ($debug) { file_put_contents($Leagues . "league.xml", $xml->asXML()); } foreach ($xml->Scan->League as $league) { } file_put_contents($Leagues . "league.xml", $xml->asXML()); print $xml->asXML();