Example #1
0
function getGameSubscribers($gameID)
{
    $url = Config::getAPIDomain() . "/go_getgamesubscribers.php?query=gamesubscribers&gameid=" . urlencode($gameID);
    if (Config::getDebug()) {
        Config::getLogObject()->log("{$url}", PEAR_LOG_DEBUG);
    }
    $curl = @curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $xml = @curl_exec($curl);
    curl_close($curl);
    if ($xml) {
        $document = @simplexml_load_string($xml);
        echo "<h3>Users subscribed to Game</h3>";
        if (!$document) {
            return false;
        }
        echo "<ul>";
        foreach ($document->game as $game) {
            //echo('<li><a href="gocustomizegame.php?gameid=' . $game->gameid . '">' . $game->title . '</a></li>');
            echo '<li><a href="' . Config::getRootDomain() . '/goprofile.php?userid=' . $game->userid . '">' . $game->username . '</a></li>';
        }
    }
    echo "</ul>";
    return;
}
Example #2
0
function getPublicGames($params)
{
    if (count($params) > 0) {
        foreach ($params as $key => $value) {
            $value = urlencode($value);
            $queryParameters .= !empty($queryParameters) ? "&{$key}={$value}" : "?{$key}={$value}";
        }
        //foreach
    }
    //if
    $url = Config::getAPIDomain() . "/go_getpublicgames.php" . $queryParameters;
    echo $url;
    $curl = @curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $xml = @curl_exec($curl);
    curl_close($curl);
    if ($xml) {
        $document = simplexml_load_string($xml);
        echo '<ul>';
        foreach ($document->game as $game) {
            $recordcnt++;
            $gameID = $game->gameid;
            $eventName = $game->eventname;
            $stadiumName = $game->stadium->stadiumname;
            $stadiumCity = $game->stadium->city;
            $latitude = $game->stadium->latitude;
            $longitude = $game->stadium->longitude;
            $eventDateTime = $game->eventdatetime;
            $tmpDateTime = new DateTime($eventDateTime);
            $formatedEventDateTime = $tmpDateTime->format('F d,Y g:i A');
            $customizeUrlParameter = "?publicgameid={$gameID}&action=customize";
            echo '<li><a href="gocustomizebet.php' . $customizeUrlParameter . '">' . $eventName . '</a> at ' . '<a href="gowhatsnearby.php">' . $stadiumName . ',' . $stadiumCity . '</a> on ' . $formatedEventDateTime . '</li>';
        }
        echo '</ul>';
    }
    //if
}
Example #3
0
function getUserSubscribedGames($userID)
{
    $url = Config::getAPIDomain() . "/go_getusergames.php?query=subscribed&userid=" . urlencode($userID) . "&sort=recent";
    $curl = @curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $xml = @curl_exec($curl);
    curl_close($curl);
    if ($xml) {
        $document = simplexml_load_string($xml);
        echo "<h3>Recent Bets Accepted</h3>";
        echo "<ul>";
        $recordcnt = 0;
        foreach ($document->game as $game) {
            $recordcnt++;
            if ($recordcnt <= 5) {
                echo '<li><a href="gocustomizegame.php?gameid=' . $game->gameid . '">' . $game->title . '</a></li>';
            } else {
                echo '<li><a href="godashboard.php">See All your Accepted Bets</a></li>';
                break;
            }
            //if
        }
        //foreach
    }
    //if
    echo "</ul>";
    return;
}
Example #4
0
function insertNewUser($params)
{
    global $LOG;
    $userID = 0;
    $userName = $params['newusername'];
    $password = $params['newpassword'];
    $url = Config::getAPIDomain() . "/go_postnewuser.php?" . "newusername="******"&password="******"calling insertNewUser using url = " . $url);
    }
    $curl = @curl_init($url);
    $opts = Facebook::$CURL_OPTS;
    curl_setopt_array($curl, $opts);
    $result = @curl_exec($curl);
    $LOG->log("{$result}");
    @curl_close($curl);
    /* Parse the returned XML */
    $document = @simplexml_load_string($result);
    if ($document) {
        //check the return code
        if ($document->status_code == 200) {
            $userID = $document->userid;
        } else {
            return false;
        }
    }
    //
    return $userID;
}