JustPaste.it

<?php
$lines = file('unique.txt');                                              // Reads the file with the list of user numbers
$timestamp = time();                                                    // Defines time for below renaming

foreach ($lines as $usernumber) {                                         // Loops line by line
$link = 'http://backpack.tf/api/IGetUsers/v2/?&steamids=' . $usernumber . '&format=json';
$json = file_get_contents($link);                                        // Reads link (this ^)
$data = json_decode($json);                                                // Defines decode as json
        if (!empty($data->backpack_value)) {
            $profiles = array(); //init array so we can use $profiles[] later
            $limitValue = 10;  //Limit value of backpack_value
            foreach($data->response->players as $player) { // Loop thrugh all the players
              if ($player->backpack_value < $limitValue) { // Check the backpack_value
            $profiles[] = $player; // Assign the required players to a new array
            var_dump($profiles); // Dump the array to browser for debugning
    
            $fh = fopen("final." . $timestamp . ".txt", 'a') or die("can't open file");    // Opens final.txt to write in
            fwrite($fh, $usernumber);                                    // Writes the parsed results to final.txt
            } //closes if $playtime
            
            } //closes foreach $data
            } //closes if !empty
            else {echo $data; }
            } //closes foreach $lines

        
?>