Page 1 of 1

?Include/Req dynamic file?

Posted: Fri Feb 14, 2003 8:13 pm
by Sky

Code: Select all

<? 
global $bsnews;
function file_to_array($news_url, $seperator)
{
	//Get Contents
		$bsnews['prearray'] = require($news_url);
	//Strip tags
		$bsnews['prearray'] = strip_tags($bsnews['content']);
	//Add Delimiters
		$bsnews['prearray'] = str_replace("2003", "|2003", $bsnews['prearray']);
	//Add ending delmiter
		$bsnews['prearray'] .= $seperator;
	//Explode to level one
		$bsnews['array'] = explode($seperator, $bsnews['prearray']);
	//Remove Blank Keys
		$bsnews['array'] = array_slice($bsnews['array'], 1, -1);
	//Loop and explode to level two
		for($i = 0; $i < count($bsnews['array']); $i++)
		{
			//Explode Key
				$bsnews['array2'][$i] = explode("	", $bsnews['array'][$i]);
			//Assign Key0 to Date
				$bsnews['final'][$i]['date'] = $bsnews['array2'][$i]['0'];
			//Assign Key1 to Contest
				$bsnews['final'][$i]['contest'] = $bsnews['array2'][$i]['1'];
			//Assign Key2 to Content
				$bsnews['final'][$i]['content'] = $bsnews['array2'][$i]['2'];
		}
		//Return $BattleSpotNews
			return $bsnews;
}
//Test function
	file_to_array("http://www.battlespot.com/mindrover/news/dump?r=", "|");
//Additional Test, Print the array.
	print_r($bsnews['final']);
?>

Posted: Sun Feb 16, 2003 8:05 am
by Sky
Ok, I can now stick a .txt on the end of the file if that would help, but the other issue is it's off-server. If I can still get it, can I get some input as to how?

Posted: Mon Feb 17, 2003 4:50 pm
by Sky
hate to do this, but i couldn't get any help on the irc channel so bump.