/** * Получение списка игроков на сервере */ function get_players() { $this->CI->load->helper('games'); $return = array(); if ($result = $this->command('status')) { $return = array(); // id name ping connected addr // 76561198041740340 "ACE ;j" 125 2919s 176.51.201.18 // 76561198042221933 "RK" 78 869s 176.51.246.210 $pattern = '!\\s*(\\d*)\\s*\\"(.*?)\\"\\s*\\d*\\s*(\\d*s)\\s*([0-9\\.]*)!si'; $matches = get_matches($pattern, $result); $count = count($matches); $a = 0; while ($a < $count) { $return[] = array('user_name' => htmlspecialchars($matches[$a]['2']), 'user_id' => $matches[$a]['1'], 'steam_id' => steamid64_to_steamid($matches[$a]['1']), 'user_ip' => $matches[$a]['4'], 'user_time' => $matches[$a]['3']); $a++; } } return $return; }
function get_players() { if ($result = $this->command('status')) { $return = array(); $pattern = '!#([\\s]*)(\\d*)([\\s]*)"(.*?)"(\\s*)([a-zA-Z0-9\\_\\:]*)(\\s*)([0-9\\:]*)(\\s*)(\\d*)(\\s*)(\\d*)(\\s*)([a-zA-Z0-9\\_\\:]*)(\\s*)(.*):(\\d*)!si'; $matches = get_matches($pattern, $result); $count = count($matches); $a = 0; while ($a < $count) { $return[] = array('user_name' => htmlspecialchars($matches[$a]['4']), 'steam_id' => $matches[$a]['6'], 'user_id' => $matches[$a]['2'], 'user_ip' => $matches[$a]['16'], 'user_time' => $matches[$a]['8']); $a++; } return $return; } else { return false; } }
$curr_match_odds[] = $tmp_odds; } } } } $connUrl = join(DIRECTORY_SEPARATOR, array('..', 'conn', 'mysqlAdminPDO.php')); include $connUrl; $trncSql = 'truncate ulaz_new; truncate ulaz_odds;'; $delete = $conn->prepare($trncSql); $delete->execute(); $conn = null; echo "Skidam mečeve <br>"; $curr_cmp_id = 77; $curr_cmp_name = 'Argentina 1'; $curr_url = "https://www.soccerbet.rs/api/Match/GetFilteredScheduledMatches?ItemsPerPage=50&CurrentPage=1&SortOrderFilterId=1&TimeFilterId=7&CompetitionIds={$curr_cmp_id}"; get_matches($curr_url, $curr_cmp_id, $curr_cmp_name); $numMatches = sizeof($curr_match_data); echo "Skinuo sam {$numMatches} mečeva <br>"; echo "Skidam kvote <br>"; foreach ($curr_match_data as $m) { // print_r($m); $matchId = $m['code']; get_match_odds($matchId); // echo "<br />"; } $tmpOdds = fopen("Odds.txt", "w"); foreach ($curr_match_odds as $d) { $betGame = $d['bet_game']; $betSubgame = $d['bet_subgame']; $OddValue = $d['odd_value']; $code = $d['code'];
<?php /** * Created by PhpStorm. * User: petar * Date: 24.3.2016 * Time: 12:42 */ $url = 'https://wwin.com/sports/'; function get_matches($url) { $curr_url = $url; $xmlMatchData = file_get_contents($curr_url); $curr_data = json_decode($xmlMatchData); // echo $match_start_time . " - " . $match_code . " - " . $home_team_name . " - " . $home_team_id . " - " . $visitor_team_name . " - " . $visitor_team_id . "<br>"; echo $xmlMatchData; } get_matches($url);
foreach ($data->SportVMs as $sports) { if ($sports->Id == 1) { foreach ($sports->CountryVMs as $cmpc) { foreach ($cmpc->CompetitionVMs as $cmp) { $tmp = array(); $tmp['cmp_id'] = $cmp->Id; $tmp['cmp_name'] = $cmp->Name; array_push($competitions, $tmp); } } } } //print_r($competitions); include 'xmltest.php'; include 'OddsTest.php'; foreach ($competitions as $c) { $curr_cmp_id = $c['cmp_id']; $curr_cmp_name = $c['cmp_name']; $curr_url = "https://www.soccerbet.rs/api/Match/GetFilteredScheduledMatches?ItemsPerPage=50&CurrentPage=1&SortOrderFilterId=1&TimeFilterId=7&CompetitionIds={$curr_cmp_id}"; get_matches($curr_url, $curr_cmp_id, $curr_cmp_name, $conn, $source); // $xmlMatchData = file_get_contents($curr_url); // $curr_data = json_decode($xmlMatchData); // // echo $curr_url."<br>"; // $match_data[] = $curr_match_data; // } // foreach($match_data as $m) { // print_r($m); // echo"<br />"; // }
// load index: $magnatune = @(require "magnatune-idx.php"); // main loop: wait for a query, try and find match and reply. while (!feof($in)) { // get the length of the payload from the first 4 bytes: $len = 0; $lenA = unpack('N', fread($in, 4)); $len = $lenA[1]; if ($len == 0) { continue; } // read $len bytes for the actual payload and assume it's a JSON object. $msg = fread($in, $len); $rq = json_decode($msg); // TODO validation - was it valid json? $pis = get_matches($rq); // don't reply with anything if there were no matches: if (count($pis) == 0) { continue; } $res = new stdclass(); $res->_msgtype = "results"; $res->qid = $rq->qid; $res->results = array(); $res->results = $pis; send_reply($res); } // put a 4-byte big-endian int first, denoting length of message function send_reply($obj) { // i think json_spirit rejects \/ even tho it's valid json. doh.