Okay, running out of ideas here, so here are TWO more solutions that work locally for me.
Solution #1: File #1
PHP Code:
<?php
$chan = "";
$streams = array( "meditor996", "malidude", "tacsecret", "izual155", "porkyhd", "tachydro#", "church_", "tainttubes", "kurimlinn", "TacvFOX", "tacpinkiepie", "dkrstarcraft", "chaoss tarcraft", "thepandrexlive", "zren89", "1soulfire", "sallvain", "sg_goldster", "adramelechii", "dragon", "dignitasselect", "sing_sing", "desrowfighting", "eghuk", "eg_idra", "rootcatz", "liquidsheth", "spanishiwa", "mtwdimaga", "whitera", "meditor996", "colqxc", "kraglord", "tsm_dyrus", "nyjacky", "crs_saintvicious", "tsm_theoddone", "mstephano", "protech", "tacmoose" );
$out = array();
foreach ($streams as $channelName) {
$chan = "http://api.justin.tv/api/stream/list.json?channel=" . $channelName;
$json_file = @file_get_contents($chan);
$exist = strpos($json_file, 'name');
if($exist) {
$out[$channelName] = json_decode($json_file, true);
}
}
file_put_contents("channels.txt", serialize($out));
?>
Solution #1: File #2
PHP Code:
<?php
echo '<br><br><font color="white"><b>Live User Streams:</b></font>';
$files_data = file_get_contents("channels.txt");
$json_files = unserialize($files_data);
foreach ($json_files as $channelName => $json_array) {
if (count($json_array) != 0 && isset($json_array[0]) && count($json_array[0]) != 0)
{
if ($json_array[0]['name'] == "live_user_{$channelName}")
$live = true;
else
$live = false;
$userLINK = "<a href=\"http://www.twitch.tv/$channelName\" target=\"_blank\" title=\"" . htmlentities($json_array[0]['title']) . "\" style='color: #C0C0C0'>";
echo "<font style=tahoma color=white size=2>" . "<br>" . " " . " " . " " . $viewers . " " . $gameSTR . " " . $userLINK . $channelName . "</a>" . "</font>";
}
}
echo "</span>";
?>
Solution #2: File #1
PHP Code:
<?php
$chan = "";
$streams = array( "reckful", "meditor996", "malidude", "tacsecret", "izual155", "porkyhd", "tachydro#", "church_", "tainttubes", "kurimlinn", "TacvFOX", "tacpinkiepie", "dkrstarcraft", "chaoss tarcraft", "thepandrexlive", "zren89", "1soulfire", "sallvain", "sg_goldster", "adramelechii", "dragon", "dignitasselect", "sing_sing", "desrowfighting", "eghuk", "eg_idra", "rootcatz", "liquidsheth", "spanishiwa", "mtwdimaga", "whitera", "meditor996", "colqxc", "kraglord", "tsm_dyrus", "nyjacky", "crs_saintvicious", "tsm_theoddone", "mstephano", "protech", "tacmoose" );
$out = array();
foreach ($streams as $channelName) {
$chan = "http://api.justin.tv/api/stream/list.json?channel=" . $channelName;
$json_file = @file_get_contents($chan);
$exist = strpos($json_file, 'name');
if($exist) {
$out[$channelName] = json_decode($json_file);
}
}
file_put_contents("channels.txt", serialize($out));
?>
Solution #2: File #2
PHP Code:
<?php
echo '<br><br><font color="white"><b>Live User Streams:</b></font>';
$files_data = file_get_contents("channels.txt");
$json_files = unserialize($files_data);
foreach ($json_files as $channelName => $json_array) {
if (count($json_array) != 0 && isset($json_array[0]) && count($json_array[0]) != 0)
{
if ($json_array[0]->name == "live_user_{$channelName}")
$live = true;
else
$live = false;
$userLINK = "<a href=\"http://www.twitch.tv/$channelName\" target=\"_blank\" title=\"" . htmlentities($json_array[0]->title) . "\" style='color: #C0C0C0'>";
echo "<font style=tahoma color=white size=2>" . "<br>" . " " . " " . " " . $viewers . " " . $gameSTR . " " . $userLINK . $channelName . "</a>" . "</font>";
}
}
echo "</span>";
?>
Now the one thing that I think was holding you up, and myself for that matter was original File #1 in both solutions had $out[] = array(), which created a blank multi-dimensional array right off the bat, that caused confusion in the script and now that is resolved, so hopefully this works.
Bookmarks