<?php
define("_VALID_PARENT", 1);
require ("libs/phpdenora/init.php"); //You have to provide the proper path to the file here
$link = sql_db_connect();
echo json_encode(denora_who_in_channel(mysql_real_escape_string(trim($_GET["channel"], '"'))));
sql_db_close($link);
?>
define("_VALID_PARENT", 1);
require ("libs/phpdenora/init.php"); //You have to provide the proper path to the file here
$link = sql_db_connect();
echo json_encode(denora_who_in_channel(mysql_real_escape_string(trim($_GET["channel"], '"'))));
sql_db_close($link);
?>
It works like this : http://stats.yournetwork.net/userlist.php?channel=%23yourchannel
In PHP, to get the file content and parse it into an array, you will need to do something like this :
$userlist = json_decode(file_get_contents("http://stats.yournetwork.net/userlist.php?channel=%23yourchannel"), true);
To loop through the array, you will need to follow this logic :
foreach ($userlist as $userinfo) {
foreach ($userinfo as $infokey => $infovalue) {
//echo $infokey . " : " . $infovalue . ", ";
}
//echo "\n";
}
}
//echo "\n";
}
If you want to access only a single attribute per user, like for example, if you only want to list the nicknames, you can access the attribute directly by its name by doing something like this :
foreach ($userlist as $userinfo) {
echo $userinfo["nick"];
}
See also : http://whatnwhat.blogspot.com/2011/11/irc-get-user-count-of-channel-in-plain.html
No comments:
Post a Comment