Exemplo n.º 1
0
 function addFriendsToUsers($steamID)
 {
     $apikey1 = "238E8D6B70BF7499EE36312EF39F91AA";
     $pushFriends = "http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key={$apikey1}&steamid={$steamID}&relationship=friend";
     //echo "addFriends initialized";
     //echo $apikey1;
     $jsonList = file_get_contents($pushFriends);
     $json_decode = json_decode($jsonList);
     /*
     #When not requesting for a different file format
     #steam will output its data in a JSON.here I am 
     #taking the decoded JSON file and reading through 
     #for particular information;		
     */
     //echo $json_decode->friendslist->friends[0]->steamid;
     foreach ($json_decode->friendslist->friends as $friend) {
         $friendID = $friend->steamid;
         retrieveUserInfo($friendID);
     }
 }
Exemplo n.º 2
0
            $csv = fgetcsv($fh);
            if (!strcmp($apikey, $csv[0])) {
                return $csv;
            }
        } while ($csv !== FALSE);
    } finally {
        fclose($fh);
    }
    return FALSE;
}
$app->post('/api/updates/', function () use($app) {
    $apiKey = $app->request->headers->get('apikey');
    if (!strlen($apiKey)) {
        $app->halt(400, json_encode(array('status' => 0, 'message' => 'Please specify API key')));
    }
    if (($csv = retrieveUserInfo($apiKey)) === FALSE) {
        $app->halt(401, json_encode(array('status' => 0, 'message' => 'Invalid API key')));
    }
    $timestamp = $app->request->headers->get('timestamp');
    if (!strlen($timestamp)) {
        $app->halt(400, json_encode(array('status' => 2, 'message' => 'Please specify Timestamp')));
    }
    $fingerprint = $app->request->headers->get('fingerprint');
    $timestamp = intval($timestamp);
    $current = intval(time());
    $terms = 0;
    $tsB = $current - 90;
    $tsA = $current + 90;
    do {
        if ($timestamp > $current) {
            $diff = $timestamp - $current;
Exemplo n.º 3
0
function retrieveSource($apikey)
{
    return retrieveUserInfo($apikey)[2];
}
Exemplo n.º 4
-1
function requestProcessor($request)
{
    echo "received request" . PHP_EOL;
    var_dump($request);
    if (!isset($request['type'])) {
        return "ERROR: unsupported message type";
    }
    switch ($request['type']) {
        case "login":
            //return doLogin($request['username'],$request['password']);
            $auth = doLogin($request['username'], $request['password']);
            if ($auth == true) {
                return array('hello' => 'world');
            }
        case "validate_session":
            return doValidate($request['sessionId']);
            //in case friends this will return a list of friends from
            //the the steam user, and send it in an array to the client.
        //in case friends this will return a list of friends from
        //the the steam user, and send it in an array to the client.
        case "showFriends":
            return showFriends($request['steamid']);
        case "popFri":
            addFriendsToUsers($request['steamid']);
        case "add":
            retrieveUserInfo($request['steamid']);
            //return array("returnCode" => '0', 'message'=>"Server received request and processed");
    }
    //return array("returnCode" => '0', 'message'=>"Server received request and processed");
}