Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Pobieranie zawartości
lanceq
post
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 3.07.2012

Ostrzeżenie: (0%)
-----


Witam, chciałbym zdalnie pobrać zawartość pewnego pliku na zewnętrznym serwerze.
Plik z którego chce pobierać znajduje się na: http://ot.lanceq.pl/config/serverstatus

Zawartość tego pliku wygląda tak:

serverStatus_checkInterval = "303"
serverStatus_lastCheck = "1341746105"
serverStatus_online = "1"
serverStatus_players = "0"
serverStatus_playersMax = "1000"
serverStatus_uptime = "0h 18m"
serverStatus_monsters = "724"

(te wartości się zmieniają)


Chciałbym aby na zdalnym serwerze był wyświetlany wynik dla: serverStatus_players, serverStatus_playersMax, serverStatus_uptime i serverStatus_monsters oraz dla serverStatus_online ale w _online chciałbym że gdy == 1 to żeby wypisywało online a jak _online == 0 to żeby wypisywało offline.

Pozdrawiam.

Ten post edytował lanceq 8.07.2012, 12:29:23
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lanceq
post
Post #2





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 3.07.2012

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $wynik = file_get_contents('http://ot.lanceq.pl/config/serverstatus');
  3. echo $wynik;
  4. ?>


Zrobiłem tak i wyświetla to tak

serverStatus_checkInterval = "303" serverStatus_lastCheck = "1341750803" serverStatus_online = "1" serverStatus_players = "0" serverStatus_playersMax = "1000" serverStatus_uptime = "1h 37m" serverStatus_monsters = "724"

Za bardzo nie wiem jak wykorzystać parse_ini_string w tym.
Chciałbym żeby to wyświetlało się tak:

Online/Offline: serverStatus_online
Uptime: serverStatus_uptime
Ilość graczy: serverStatus_players / serverStatus_playersMax
Ilość potworów: serverStatus_monsters

Ten post edytował lanceq 8.07.2012, 13:53:58
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 02:16