123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|281|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Online Scoreboard (aka 'An actual question! w00t)

Fri, 06 Jun 2008, 14:19
Afr0
Put quite simply; I'm making a Space Invaders game in C# with XNA, and I got the idea I might add an online scoreboard. Any idea how I'd go about doing that? I know pretty much how to communicate with a webserver from within C#, but I don't know how to interact with a php script. Also, what would go into the php script?

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Fri, 06 Jun 2008, 14:52
Jayenkai
The way I did it with Alien Deathmatch..
1. Figure out how to read a webpage, nice and simple.
2. Figure out how to send "GET" style data, when requesting the webpage.


^ that!

3. In the php...
$MyData=@$_GET[data];
Which should = the data that was sent above..
Do with it what you will.

4. Output the returned data using echo, which will be input in Blitz
Repeat
LineofData$=ReadLine$(site)
^ grab it line by line, do what you will on the Blitz side
Until Eof(site)

5. Done, don't forget to close up..


It's very very simple.
Basically, request a page, instead of having to output the HTML header, the <html> tags, etc, just spew out what you want, then get Blitz to deal with it when it gets back.
Sorted..

(But, you know, for CWhatever instead)


-=-=-
''Load, Next List!''
Fri, 06 Jun 2008, 16:10
Scherererer
you should use ASP.NET and/or a webservice instead of php if you're going to be using C# anyway -- since those use C# aswell.

The ASP.NET route would be similar to the php explination that jay gave -- the webservice would allow you to add the service as a library to your project and then do regular function calls.

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Sat, 07 Jun 2008, 03:48
Afr0
Hm, I've written Webservice hosting apps before for my servers, but that would require me to use dedicated hosting, which I don't have atm. I'll definately look into ASP.NET!

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Tue, 10 Jun 2008, 03:16
oscar
The only problem with using ASP.Net is that it isn't as cheap as some of the PHP/mysql options out there.
Tue, 10 Jun 2008, 19:53
Stealth
What your looking to do is fairly simple stuff.

In PHP it would be something like:



-=-=-
Quit posting and try Google.
Wed, 11 Jun 2008, 15:11
mike_g
Might also be a good idea to sanatise your input queries

https://uk3.php.net/mysql_real_escape_string