SRL Archive - General

Timer 4 Runite


Laimonas171

2009-07-02 11:52:04

Can anyone make this timer on PHP
[textbox] [submit] [timertext]
[textbox] you enter world number
[submit] submit key
[timertext] shows how much time left

formula

(1290.0 - ((worldPlayersAmount) / 100.0 - 2.0) * 30.0));

worldPlayersAmount == [textbox] (entered world number players amount)

page from where need to get world players amount
http://www.runescape.com/slu.ws

Laimonas171

2009-07-03 17:05:17

anyone…

Da 0wner

2009-07-03 17:07:32

What language?

ian.

2009-07-03 17:24:49

"Can anyone make this timer on PHP"

Da 0wner

2009-07-03 18:49:33

It was not like that before.

ian.

2009-07-03 19:22:56

His post -
Last edited by Laimonas171; Yesterday at 08:58 AM.

Your post -
Today, 02:07 PM

He edited it with that edit, so yes, it was there.

Laimonas171

2009-07-03 19:55:27

so it should be on PHP how i was said, how i see anyone can't or just don't want to help . :/

Da 0wner

2009-07-03 19:58:13

From: 99_ aka ian.
His post -
Last edited by Laimonas171; Yesterday at 08:58 AM.

Your post -
Today, 02:07 PM

He edited it with that edit, so yes, it was there.

I saw this before, I just didn't post…

So I don't assume that he would randomly edit it. That is why I skipped over it.

Nadeem

2009-07-03 23:14:46

This shouldn't be too hard :) You can easily get the file contents with using file_get_contents() and search for appropriate fields and get the amount of players :p Using the formula would be like eating cake :D

I can do this for you when I get home.



~NS

Laimonas171

2009-07-03 23:40:04

From: Nadeem
This shouldn't be too hard :) You can easily get the file contents with using file_get_contents() and search for appropriate fields and get the amount of players :p Using the formula would be like eating cake :D

I can do this for you when I get home.



~NS


oh man I'll be very thankful I'll w8 your code. :)

Laimonas171

2009-07-04 01:49:49

[PHP]<?php

$data = file_get_contents("http://www.runescape.com/slu.ws?order=WMLPA");
$search = strstr($data, "World 20");
$players = substr($search, 23, 4);
echo $players;

?>[/PHP]

It write value but, not for all world properly, example if world is FULL, then it takes wrong values, or something like that, can anyone make code working on all worlds.

Da 0wner

2009-07-04 01:52:37

if ($players=='FULL')
$players = '2000';

:D?

Nadeem

2009-07-04 04:12:48

Here you go, as promised :)

[PHP]<?php

if (isset($_POST["getPlayers"])) {
if (!$_POST["world"])
echo "Please enter world number";
else {
$world = $_POST["world"];
$data = file_get_contents("http://www.runescape.com/slu.ws?order=WMLPA");
$search = strstr($data, "World {$world}");
$players = substr($search, 21 + strlen($world), 4);
$players = trim($players);
$players = (is_numeric($players) ? $players : 2000);

echo $players." players";
}
}

print <<<EOD
<form action="" method="post">
<label for="world">World:</label>
<input type="text" name="world" value="{$_POST["world"]}" />
<input type="submit" name="getPlayers" value="Get Players" />
</form>
EOD;
?>[/PHP]




~NS

Laimonas171

2009-07-04 12:24:06

From: Nadeem
Here you go, as promised :)

[PHP]<?php

if (isset($_POST["getPlayers"])) {
if (!$_POST["world"])
echo "Please enter world number";
else {
$world = $_POST["world"];
$data = file_get_contents("http://www.runescape.com/slu.ws?order=WMLPA");
$search = strstr($data, "World {$world}");
$players = substr($search, 21 + strlen($world), 4);
$players = trim($players);
$players = (is_numeric($players) ? $players : 2000);

echo $players." players";
}
}

print <<<EOD
<form action="" method="post">
<label for="world">World:</label>
<input type="text" name="world" value="{$_POST["world"]}" />
<input type="submit" name="getPlayers" value="Get Players" />
</form>
EOD;
?>[/PHP]




~NS

thank you works great :)

Laimonas171

2009-07-04 13:52:18

From: Nadeem
Here you go, as promised :)

[PHP]<?php

if (isset($_POST["getPlayers"])) {
if (!$_POST["world"])
echo "Please enter world number";
else {
$world = $_POST["world"];
$data = file_get_contents("http://www.runescape.com/slu.ws?order=WMLPA");
$search = strstr($data, "World {$world}");
$players = substr($search, 21 + strlen($world), 4);
$players = trim($players);
$players = (is_numeric($players) ? $players : 2000);

echo $players." players";
}
}

print <<<EOD
<form action="" method="post">
<label for="world">World:</label>
<input type="text" name="world" value="{$_POST["world"]}" />
<input type="submit" name="getPlayers" value="Get Players" />
</form>
EOD;
?>[/PHP]




~NS


Hello, maybe you able make 10-20 diferend same forms, for using some worlds on the same time, and make timer for $timeLeft -1000ms, auto refreshing can be php or js, if you able to do that. :)

Da 0wner

2009-07-05 12:48:30

header('refresh:SECONDS') if a get or post variable is set..?