Main sections
NETWEBGET
contents$ = NETWEBGET$(server$, path$, port%, max_length%, timeout%=5000)
contents$ = NETWEBGET$(proxy$, server_and_path$, proxy_port%, max_length%, timeout%=5000)
Liest den Inhalt einer Webseite in eine Wortvariable.
Zur Erläuterung der Parameter, sie auch:
ok% = NETWEBGET(server$, path$, port%, local$, timeout%=5000)
ok% = NETWEBGET(proxy$,server_and_path$, proxy_port%, local$, timeout%=5000)
Speichert eine HTTP URL auf die lokale Festplatte.
server$ - server name
proxy$ - IP des Proxy-Server (falls vorhanden)
pfad$ - pfad auf dem Server.
server_and_path$ - Volle URL wenn ein Proxy verwendet wird.
port% - port zum Öffnen. Normalerweise 80
lokal$ - lokaler Dateiname
timeout% - Zeit bis zum Fehler bei Zeitüberschreitung in Millisekunden.
FUNCTION ReadHighScores: names$[], scores[], username$, thescore
LOCAL ct, i, str$, proxy$, port
str$ = "highscores/listgame.php"
str$ = str$ + "?game=mygame"
str$ = str$ + "&name="+username$
str$ = str$ + "&score="+thescore
str$ = str$ + "&secret=mycode"
PRINT ".: WebGet scores :.", 0, 0
SHOWSCREEN
INIOPEN "config.ini"
proxy$ = INIGET$("server", "proxy")
port = INIGET$("server", "port")
KILLFILE "scores.ini"
IF port=0 OR proxy$="NO_DATA"
NETWEBGET("www.glbasic.com", "/"+str$, 80, "scores.ini")
ELSE
NETWEBGET(proxy$, "http://www.glbasic.com/" + str$, port, "scores.ini")
ENDIF
INIOPEN "scores.ini"
ct = INIGET$("scores", "count")
DIM names$[ct]
DIM scores[ct]
FOR i=1 TO ct
names$[i-1] = INIGET$("scores", "n"+i)
scores[i-1] = INIGET$("scores", "s"+i)
NEXT
ENDFUNCTION