runescape-werelden

Gesponsorde koppelingen

PHP script bestanden

  1. runescape-werelden

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?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++;
}


?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.