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. $array = explode(" = ", $wynik);
  4. var_dump($array);//to tylko po to byś zobaczył jak to wygląda
  5. ?>


I wyświetla się to tak

array(8) { [0]=> string(26) "serverStatus_checkInterval" [1]=> string(29) ""303" serverStatus_lastCheck" [2]=> string(33) ""1341753794" serverStatus_online" [3]=> string(25) ""1" serverStatus_players" [4]=> string(28) ""0" serverStatus_playersMax" [5]=> string(27) ""1000" serverStatus_uptime" [6]=> string(31) ""2h 27m" serverStatus_monsters" [7]=> string(7) ""724" " }


Trochę nie tak jak chciałem.

Ten post edytował lanceq 8.07.2012, 14:33:01
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: 5.10.2025 - 16:45