[code]
<?php
/*
###
### Made By Chessspider ( www.chessspider.nl - 2008© ) 
###
### Please leave this notice here. If you really want to make me happy, also put a link to my runescape world switcher:
### http://worldswitcher.chessspider.nl/
### on your website.
*/


/* Setting vars */

$location = "http://www.runescape.com/slj.ws?plugin=0&lores.x=143&lores.y=60"; // website to parse
$locations = array(
			0 => "US West 1",
			1 => "US West 2",
			2 => "US West 3",
			3 => "UK 2",
			4 => "US West 5",
			5 => "UK 1",
			6 => "Canada East",
			7 => "US East 2",
			8 => "US Central 3",
			9 => "US Central 2",
			10 => "Netherlands 1",
			11 => "US Central 1",
			12 => "US West 4",
			13 => "US East 1",
			14 => "US East 3",
			15 => "Australia",
			16 => "Sweden",
			17 => "Canada West",
			18 => "Finland",
			19 => "Netherlands 2",
			20 => "US Central 2"
		); // locations


$html = ""; // full webpage
$worlds = array(); // unparsed worlddata

$html = @file_get_contents($location);
if($html == false)
{
	echo "<br />Website does not exist. Unable to continue";
	exit;
}

/* Narrowing down the search area */
$html = explode('<script type="text/javascript" language="javascript">',$html);
$html = explode("</script>",$html[1]);

// Retrieve the worlds
preg_match_all("/(e\(([0-9]{1,3},[0-9]+,[0-9]+,.+,(true|false),.+,[0-9]+,[0-9]+)\);)/",$html[0],$worlds);

// Parse the worlds
foreach($worlds[2] as $world)
{
	list($worldnumber,$type,$status,$activity,$highlight,$url,$players,$location) = explode(",",$world);
		
	$worldnumber = intval($worldnumber);
	$type = intval($type) ? "member" : "free";
	$status = intval($status) == 0 ? "Open" : ( intval($status) == 1 ? "Offline" : "Closed" );

	$activity = addslashes(str_replace('"','',$activity)); 
	$highlight = ($highlight == "true"); // lets make it a real boolean..
	$url = str_replace('"','',$url);
	$players = intval($players);
	$location = isset( $locations[intval($location)] ) ? $locations[intval($location)] : "Unknown";
	
	$return[$worldnumber] = compact("worldnumber","type","status","spec","highlight","url","players","location");

}
unset($worlds,$html);
ksort($return);

$i = 1;
foreach($return as $world => $values)
{
	while($i < $world) // To compensate for missing worldnumbers
	{
		echo "<h2>World $i</h2>\n";
		echo "This world does not exist";
		$i++;
	}
	echo "<h2>World $world</h2>";
	echo "<p>This is a ".$values['type']." world, with ".$values['players']." players playing. The world is located in ".$values['location']."<br />
			<a href='http://".$values['url'].".runescape.com/l1,p0,j1'>To play, click here</a></p>"; 
	$i++;
}

?>
[/code]