Beispiel #1
0
    saveResults($dbh, $res);
    $sport = 'nhl';
    $res = grabResults($ch, $sport);
    saveResults($dbh, $res);
    $sport = 'ncaab';
    $res = grabResults($ch, $sport);
    saveResults($dbh, $res);
    $sport = 'ncaaf';
    $res = grabResults($ch, $sport);
    saveResults($dbh, $res);
    $sport = 'mma';
    $res = grabResults($ch, $sport);
    saveResults($dbh, $res);
    $sport = 'tennis';
    $res = grabResults($ch, $sport);
    saveResults($dbh, $res);
}
mysqli_close($dbh);
curl_close($ch);
function grabResults($ch, $sport)
{
    curl_setopt($ch, CURLOPT_URL, "https://jsonodds.com/api/results/" . $sport);
    $res = curl_exec($ch);
    return json_decode($res);
}
function saveResults($dbh, $res)
{
    foreach ($res as $result) {
        $data = array('event_id' => $result->ID, 'HomeScoore' => $result->HomeScore, 'AwayScore' => $result->AwayScore);
        if ($result->Final == 1) {
            $query = 'insert into archives values(0,';
Beispiel #2
0
     } else {
         admin();
     }
     break;
 case "checkratio":
     //sprawdzenie i dodanie wspó3czynnika
     if ($pcat == 3 || $pcat == 4) {
         checkGameProperties();
     } else {
         admin();
     }
     break;
 case "saveresults":
     //zapisanie wyników turnieju
     if ($pcat == 3 || $pcat == 4) {
         saveResults();
     } else {
         admin();
     }
     break;
     // ************ Funkcje edycji Wyników *********************//
 // ************ Funkcje edycji Wyników *********************//
 case "searchresults":
     //formularz wyszukiwania turnieju w celu edycji wynikow
     if ($pcat == 3 || $pcat == 4) {
         gameTable('editresults');
     } else {
         admin();
     }
     break;
 case "editresults":
        if ($position === FALSE) {
            $logFile = getcwd() . "/{$logFile}";
        }
        $logFileName = basename($logFile);
    } else {
        print "Error, must supply a path to a log file with -v option\n";
        print $usage;
        exit(1);
    }
    print "calling verifyUploads with:{$logFile}\n";
    if (!verifyUploads($logFile)) {
        print "NOTE: One or more verify upload tests had errors, please investigate\n";
        echo "by running ui/tests/VerifyTests/runVerifyTests.php\n";
        exit(1);
    }
    if (!is_null($rtn = saveResults())) {
        print "ERROR! could not save the test results, please save by hand\n";
        exit(1);
    }
    exit(0);
}
function saveResults()
{
    global $Home;
    global $logFileName;
    global $LF;
    global $logFile;
    $resultsHome = "/home/fosstester/public_html/TestResults/Data/Latest/";
    if (chdir($Home) === FALSE) {
        $nohome = "Save Data ERROR: can't cd to {$Home}\n";
        LogAndPrint($LF, $nohome);