@sgsecret;
I cant view the source, 400 error.
Here we go:
<?php /* */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<?php include '_head.php';?>
</head>
<body>
<hr />
<h1>
<a href='http://www.sitepoint.com/forums/showthread.php?890672-Help-with-speeding-up-php-code&p=5201789#post5201789'>
SitePoint Forum:
</a>
</h1>
<hr />
<div id='main'>
<?php
echo "<h2 class='flr'>start: " .date('H:i:s') ,'</h2>';
$nodes = array
(
"meditor996", "malidude", "tacsecret", "izual155", "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", "tacmoose"
);
$node_count = count($nodes);
$curl_arr = array();
$master = curl_multi_init();
// initialise each and every node
$uuu = "http://api.justin.tv/api/stream/list.json?channel=";
for($i2 = 0; $i2 < $node_count; $i2++)
{
# echo '<br />',
$url = $uuu ."{" .$nodes[$i2] ."}";
$curl_arr[$i2] = curl_init($url);
curl_setopt($curl_arr[$i2], CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle($master, $curl_arr[$i2]);
}
// Curl_Multi_exec - go and do your stuff
do
{
curl_multi_exec($master,$running);
} while($running > 0);
//
echo '<dl>';
for($i2 = 0; $i2 < $node_count; $i2++)
{
$results = curl_multi_getcontent ( $curl_arr[$i2] );
$len = strlen( $results );
if($len > 2)
{
echo '<dt>';
fn_json_decode($results, $nodes[$i2] );
echo '</dt>';
echo '<dd>';
echo htmlspecialchars($results);
echo '</dd>';
}
}
echo '</dl>';
echo "<h3 class='flr'>finish: " .date('H:i:s') .'</h3>';
//===============================
function fn_json_decode( $results, $NAME)
{
$json_file = $results; #@file_get_contents($FFF, 0, null, null);
$json_array = json_decode($json_file, true);
if ( isset($json_array[0]['name']) && $json_array[0]['name'] == "live_user_{$NAME}")
$live = true;
else
$live = false;
# Prevent warnings and errors - Not known
$viewers = ' $viewers ';
$channelTitle = ' $channelTitle ';
$gameSTR = ' $gameSTR ';
$i = 999;
$url = "http://www.twitch.tv/$i";
echo "<a
href='" .$url ."'
target='_blank'
title='" .$channelTitle ."'
style='color:#00f'
>"
.$NAME
.'</a>';
#echo "<font style=tahoma color=white size=2>" ."<br>" ." "
# . $viewers . " " . $gameSTR . " " . $userLINK . $i . "</a>"
# ."</font>";
}
?>
</div>
<div id='src'>
<a href='index.php?source=true'>
Source
</a>
<br />
<?php
if(isset( $_GET['source']))
{
highlight_file( __FILE__);
}
?>
</div>
</body>
</html>