Beispiel #1
0
            <th>info_hash</th>
            <th>peer_id</th>
            <th>ip4</th>
            <th>ip6</th>
            <th>port</th>
            <th>seed</th>
        </tr>
    </thead>
    <tbody>
        <?php 
require 'vendor/autoload.php';
$r = new Predis\Client();
$torrents = $r->smembers('torrents');
foreach ($torrents as $info_hash) {
    $peers = $r->smembers($info_hash);
    foreach ($peers as $peer_id) {
        $temp = $r->hmget($info_hash . ':' . $peer_id, 'ip4', 'ip6', 'port', 'seed');
        if (!$temp[3]) {
            $temp[3] = '0';
        }
        echo '<tr>';
        echo '<td>' . bin2hex($info_hash) . '</td>', '<td>' . bin2hex($peer_id) . '</td>', '<td>' . $temp[0] . '</td>', '<td>' . $temp[1] . '</td>', '<td>' . $temp[2] . '</td>', '<td>' . $temp[3] . '</td>';
        echo '</tr>';
    }
}
?>
    </tbody>
</table>
</div>
</body>
</html>
Beispiel #2
0
        $redis->hmset($urival, "hint2", $hint2);
    }
    if (strlen($meta) > 0) {
        $redis->hmset($urival, "meta", $meta);
    }
    // $redis->hmset($urival,"loc1",$loc1,"loc2",$loc2,"hint1",$hint1,"hint2",$hint2,"meta",$meta);
}
// test
$stage = "one";
// retrieve the record and return some JSON
header('MIME-Version: 1.0');
header("Content-Type: application/json");
$r->Netinf = "v0.1a Stephen";
$r->ni = $urival;
$r->ts = date(DATE_ATOM);
$rloc1 = $redis->hmget($urival, "loc1");
$rloc2 = $redis->hmget($urival, "loc2");
$r->loc = array_merge($rloc1, $rloc2);
$rhint1 = $redis->hmget($urival, "hint1");
$rhint2 = $redis->hmget($urival, "hint2");
$r->hints = array_merge($rhint1, $rhint2);
$r->meta = $redis->hmget($urival, "meta");
$tmp = json_encode($r);
$jout = str_replace('\\/', '/', $tmp);
print $jout;
// test
print "\n";
exit(0);
?>