Hi, I have this code that essentially checks if a video stream is live or not, posts only live streams to a txt file, then posts the live streams in a module for users to click and view those streams. But my problem is, its not showing all of the live streams, its only showing 2-4 of the live streams when I am 100% sure there are much more that are live that it is not posting.


File name: Livestreams.php
PHP Code:
<?php
$chan3 
"";
$streams3 = array( "izual155""gamegene""tacsecret""reckful""meditor996""malidude""porkyhd""tachydro#""church_""tainttubes""kurimlinn""tacvfox""tacpinkiepie""dkrstarcraft""chaosstarcraft""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""l4ad_jcade""iamteuton""sc2blingzing#""bobmoo22""tac_moose""valewalker""koshka""dollarbg""blade55555""denixsc""honeybearsc2""cainine""bokagna""syberiangamer""manbearpig1073""aethis_stream""blake8705""mmoorehead""telecomgaming""ladykayoh" );                                                                                                                                                                                                                                            

$out3 = array();

foreach (
$streams3 as $channelname3) {
    
$chan3 "http://api.justin.tv/api/stream/list.json?channel=" $channelname3;
    
$json_file3 = @file_get_contents($chan3);
    
$exist3 strpos($json_file3'name');
    if(
$exist3) {
        
$out3[$channelname3] = json_decode($json_file3);
    }
}

file_put_contents("channels.txt"serialize($out3));
?>
File name: Livestreams2.php
PHP Code:
<?php
echo '<div class="sections"><font color="white" face="arial" size=2><b>&nbsp;&nbsp;&nbsp;Live User Streams:</b></font></div><div class="hr"><hr></div>';
$files_data3 file_get_contents("channels.txt");
$json_files3 unserialize($files_data3);    

foreach (
$json_files3 as $channelname3 => $json_array3) {


    if (
count($json_array3) != && isset($json_array3[0]) && count($json_array3[0]) != 0)
    {
        if (
$json_array3[0]->name == "live_user_{$channelname3}")
            
$live true;
        else
            
$live false;
            

$userLINK3 "<a href=\"http://twitch.tv/$channelname3\" target=\"_blank\" title=\"" htmlentities($json_array3[0]->title) . "\" style='color: #c95824'>";
$game3 htmlentities($json_array3[0]->meta_game);   
$viewers3 htmlentities($json_array3[0]->channel_count);  

$gameLong3 = array( "World of Warcraft: Mists of Pandaria""StarCraft II: Heart of the Swarm""StarCraft II: Wings of Liberty""League of Legends""Minecraft""Guild Wars 2""Dota 2""StarCraft: Brood War""StarCraft""APB Reloaded""Diablo III""World of Warcraft: Cataclysm""World of Warcraft""World of Tanks""Lord of the Rings Online: Rise of Isengard""EVE Online""Mount & Blade Warband: Napoleonic Wars" );
$gameShort3 = array( "WoW""SC2""SC2""LoL""MC""GW2""DoTA2""SC""SC""APB""D3""WoW""WoW""WoT""LoTRO""EVE""M&B" );
/* CHANGE THIS NUMBER */   $MAX_LONG3 17;   /* CHANGE THIS NUMBER */ 

for($c 0$c $MAX_LONG3$c++){
    if(
$game3 == $gameLong3[$c]){
        
$game3 $gameShort3[$c];
        
$gameSTR3 "$game3";
        break;
    }else{
        
$gameSTR3 "";
    }
}

$channelname5 = array( "izual155""gamegene""tacsecret""reckful""meditor996""malidude""porkyhd""tachydro#""church_""tainttubes""kurimlinn""tacvfox""tacpinkiepie""dkrstarcraft""chaosstarcraft""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""l4ad_jcade""iamteuton""sc2blingzing#""bobmoo22""tac_moose""valewalker""koshka""dollarbg""blade55555""denixsc""honeybearsc2""cainine""bokagna""syberiangamer""manbearpig1073""aethis_stream""blake8705""mmoorehead""telecomgaming""ladykayoh" );
            
            
$nameshort = array( "TaCIzual""TaCRebecca""sGSecreT""Reckful""Meditor""Malidude""Porky""TaChydro""Church""Tainttubes""Kurimlinn""TaCvFOX""PinkiePie""Dkrstarcraft""Chaos""Thepandrexlive""Zren""1Soulfire""Sallvain""Goldster""Adramelechii""Dragon""DignitasSelect""Sing_Sing""Desrow""EGHuk""EG_idra""Rootcatz""Liquidsheth""Spanishiwa""mtwdimaga""White-Ra""Meditor""Colqxc""Kraglord""Tsm_Dyrus""Nyjacky""Crs_Saintvicious""Tsm_Theoddone""Stephano""Protech""l4ad_jcade""Iamteuton""Blingzing""BobMoo""TaCMoOsE""Thaney""Koshka""Dollar""Blade55555""Denix""HoneybearSC""Cainine""Bokagna""Syberiangamer""ManBearPig""Aethis""Edri""MMoorehead""TelecoM""LadyKayoh" );
                                    
$MAX_LONG4 61;
     
     
            for(
$d0$d $MAX_LONG4$d++){
    if(
$channelname3 == $channelname5[$d]){
        
$channelname3 $nameshort[$d];
        break;
    }
}

        echo 
"<font face=arial color=white size=1>" "<br>" "&nbsp; " "&nbsp; " "&nbsp; " "&nbsp; " "&nbsp; " "[$viewers3]" " " $gameSTR3 " " $userLINK3 $channelname3 "</a>" "</font>";
    }
}


?>
Basically, I need someone who is good at coding to figure out why only SOME of the users arent being posted to "channels.txt" and therefor not showing up on the list of live streams.

Thanks