Beispiel #1
0
<?php

spl_autoload_register(function ($class_name) {
    include "../inc/" . $class_name . '.php';
});
$object = new stdClass();
$object->draw = (int) $_REQUEST['draw'];
$object->recordsTotal = 57;
$object->recordsFiltered = 57;
$db_read = new DBRead();
$client = new PinnacleClient();
$events = $db_read->getAllEvents();
$i = 0;
$data = array();
$new_league = "<span class=\"new_league\">new league</span>";
foreach ($events as $event) {
    $data[] = array(date('d/m/Y H:i', strtotime($event['starts'])), $client->sportName($event['sportId']), $event['league'] == 'new league' ? $new_league : $event['league'], "", "", "", "", "", "", "", "", "");
}
$object->data = $data;
echo json_encode($object);
Beispiel #2
0
<?php

spl_autoload_register(function ($class_name) {
    include "../inc/" . $class_name . '.php';
});
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : PinnacleClient::SOCCER_ID;
$fixture = new Fixture($id);
$pinnacle_client = new PinnacleClient();
$json = $pinnacle_client->query("https://api.pinnaclesports.com/v1/fixtures?sportid=" . $id . "&since=" . $fixture->get('last'));
$fixture->set('last', $json->last);
foreach ($json->league as $l) {
    $league = new League($l->id);
    $league->set('sportId', $id);
    foreach ($l->events as $e) {
        $event = new Event($e->id);
        $event->set('leagueId', $l->id);
        $event->set('starts', $e->starts);
        $event->set('home', $e->home);
        $event->set('away', $e->away);
        $event->set('rotNum', $e->rotNum);
        if (isset($e->homePitcher)) {
            $event->set('homePitcher', $e->homePitcher);
        }
        if (isset($e->awayPitcher)) {
            $event->set('awayPitcher', $e->awayPitcher);
        }
    }
}
Beispiel #3
0
<?php

spl_autoload_register(function ($class_name) {
    include "../inc/" . $class_name . '.php';
});
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : PinnacleClient::SOCCER_ID;
$pinnacle_client = new PinnacleClient();
$json = $pinnacle_client->query("https://api.pinnacle.com/v2/leagues?sportid=" . $id);
foreach ($json->leagues as $l) {
    $league = new League($l->id);
    $league->set('name', $l->name);
}