Is there any way to count users in my chatroom and display whos chatting using javascript or ajax? code in php below has issues, but this is what it should do.
<?php
$chatnames = file('http://client11.addonchat.com/scwho.pl?id=292747&plain=1');
$indx = count($chatnames);
$indxcom = $indx - 1;
if ($indx == 0) {
echo "<b>No one is in the chat room at the moment</b>";
}
else{
echo "<b>People Chatting:</b> ";
for($i = 0; $i < $indx; $i++) {
$name = explode(' ', $chatnames[$i], 2);
echo " $name[0]";
if ($i < $indxcom) {
echo ", ";
}
}
}
?>
I was not able to use php on my website software directly so I was hoping to to remotely host this code and display the data by using an iframe sourced from the remote file, however various issues arose.
could I do the same thing with ajax or javascript?