function fetchCharDat() { $charTOfetch = $_GET['Char']; $fromWHATserver = $_GET['Server']; // Fetch character data [ BNET - Character Data ] $fetchedBnet = roster_BNET::fetch_char($charTOfetch, $fromWHATserver); $fetchedWCLogs = WCLogs::fetch_char_rankings($charTOfetch, $fromWHATserver); if ($fetchedBnet->code === 200) { // Show user that things are happening fetchText(); // Save returned data to DB roster_db::save_new(json_decode($fetchedBnet->content, true), json_decode($fetchedWCLogs->content, true)); } else { nochar(); } }
function concatFiles($inList, $inRoot) { //echo "<hr/>"; $s = ""; foreach ($inList as $i) { if ($i) { //echo urlencode($i)."<br/>"; $i = str_replace(" ", "%20", $i); //echo $inRoot . $i ."<br/>"; $x = fetchText($inRoot . $i); if ($x[0] === '<') { echo "<b style='background-color:red;'>Failure</b> loading: {$inRoot}{$i}<br/>"; continue; } //echo htmlspecialchars($x)."<br/>"; if ($x) { $s .= $x; } } } //echo "<hr/>"; return $s; }
$files = explode(",", $list); // Slow /* $s = concatFiles($files, $base); $s = JSMin::minify($s); $s = $prefix . $s; file_put_contents($path, $s); echo htmlspecialchars($s); */ // Still slow $fp = fopen($path, 'w'); fwrite($fp, stripBOM($prefix)); foreach ($files as $i) { if ($i) { //echo $i."<br/>"; $x = fetchText($base . $i); if ($x[0] === '<') { echo "<b style='background-color:red;'>Failure</b> loading: {$base}{$i}<br/>"; continue; } $t = stripBOM($x); if ($t) { // JSMin seems to be the cause of slowness $t = JSMin::minify($t); fwrite($fp, $t); //echo htmlspecialchars($t); } } } fclose($fp); echo "<b>Finished.</b>";