Restored from previous forum. Originally posted by yavin.
If your working on a game project, is it near complete ?
Want to add an online high score table to your game ? it couldnt be simpler, all you have to do is be able to execute a website url and have the browser open it from your code.
If you can do this and want to have your verry own online high score table for your games then visit http://www.teamrebellion.co.uk/highscore/
Online High Score Table System
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by vanleth.
I have been doing some Hiscore updating my self. Got it to work on my Test system, using PHP scripts and a little PB code.
The PB program sends a request to a php page called score.php. Score.php just create/update a file on the webhost. Simple approach.
Just can't get it to work on in a reallife test. Seem's that I'm stuck with the URI's to my webhost.
The PB code:
The score.php code
The showscore.php code
But to avoid this trouble, maybe it would be a good idea to look at your suggestion Yavin.
Any others have good ideas for doing server highscores?
Van
[EDIT]Brackets mismatch ect.[/EDIT]
I have been doing some Hiscore updating my self. Got it to work on my Test system, using PHP scripts and a little PB code.
The PB program sends a request to a php page called score.php. Score.php just create/update a file on the webhost. Simple approach.
Just can't get it to work on in a reallife test. Seem's that I'm stuck with the URI's to my webhost.
The PB code:
Code: Select all
InitNetwork()
EOL$ = Chr(13)+Chr(10)
Name$ = InputRequester("Input your Name", "Name:","")
Score = Val(InputRequester("Input fake Score", "Score:", ""))
Note$ = InputRequester("Your victory note", "Note:", "")
ScoreString$="GET /score.php?name="+Name$+"&score="+Str(Score)+"¬e="+Note$+" HTTP/1.0"+EOL$+EOL$
Length = MemoryStringLength(ScoreString$)
*Buffer = AllocateMemory(1, Length, 0)
PokeS(*Buffer, ScoreString$)
ConnectionID = OpenNetworkConnection("192.168.5.81", 80)
SendNetworkData(ConnectionID, *Buffer, Length)
end
Code: Select all
Code: Select all
Scores
\n";
print "\n";
while (!feof ($file)) {
$name = fgets($file, 4096);
$score = fgets($file, 4096);
$note = fgets($file, 4096);
print "$name$score$note\n";
}
print "\n";
fclose ($file);
?>
Any others have good ideas for doing server highscores?
Van
[EDIT]Brackets mismatch ect.[/EDIT]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by benny.
Hi,
I have a slightly simpler example ... and it seems to work.
The PB-Side looks like this:
This just sends the string "purebasic" to your php-script called blabla.php !
The blabla.php script should look like this:
This creates a file on your server called "blabla.txt" which contains the string "purebasic".
!!! Make sure before you run the script that you temporarily allow write access for creating the file blabla.txt on your server, otherwise it DOES NOT work !!!
Ok, hope I could help you a little...
Greetings, benny!
Hi,
I have a slightly simpler example ... and it seems to work.
The PB-Side looks like this:
Code: Select all
InitNetwork()
EOL$ = Chr(13)+Chr(10)
ConnectionID = OpenNetworkConnection("[url]http://www.yourhost.com[/url]", 80)
If ConnectionID
SendNetworkString(ConnectionID, "GET [url]http://www.yourhost.com/blabla.php?data=purebasic[/url] HTTP/1.0"+eol$)
SendNetworkString(ConnectionID, eol$)
EndIf
End
The blabla.php script should look like this:
Code: Select all
!!! Make sure before you run the script that you temporarily allow write access for creating the file blabla.txt on your server, otherwise it DOES NOT work !!!
Ok, hope I could help you a little...
Greetings, benny!
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by vanleth.
ahhh solved my GET / HTTP/1.0 mystery with my own webhost. There server only accepts HTTP/1.1 and above statements. So if you can't get mine or benny's example to work, maybe it's because you need to do change the GET statement to
"GET /index.html HTTP/1.1" + EOL$
"HOST: http://www.domain.net" + EOL$
EOL$ + EOL$
A good link that explains the inner works of HTTP
[LINK]http://www.jmarshall.com/easy/http/[/LINK]
Best regards
Van
ahhh solved my GET / HTTP/1.0 mystery with my own webhost. There server only accepts HTTP/1.1 and above statements. So if you can't get mine or benny's example to work, maybe it's because you need to do change the GET statement to
"GET /index.html HTTP/1.1" + EOL$
"HOST: http://www.domain.net" + EOL$
EOL$ + EOL$
A good link that explains the inner works of HTTP
[LINK]http://www.jmarshall.com/easy/http/[/LINK]
Best regards
Van
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm