interact with a php script

BlitzMax Forums/BlitzMax Programming/interact with a php script

I used blitz3d to interact with a PHP script, to host my own GNET server.
Has anyone done this with blitzmax?

Kinda. Not for GNET, or with PHP tho'. But for online storage/updates and with J2EE.

The principles are roughly the same tho'.

I just need to retrieve some basic info like how many people are playing a game online

This might help:
Local file:TStream
Local path:String = "http::www.blitzbasic.com/codearcs/codearcs.php?cat=11"
Local result:String

Try
	file = ReadStream(path)
	
	While Not Eof(file)
		
		Result:+ReadLine(file)
		
	Wend
	
Catch error:String
	
	CloseStream(file)
	RuntimeError(error)
	
End Try

CloseStream(file)

Print Result



And I can recommend JSON for small amounts of data transfer:
http://www.blitzbasic.com/codearcs/codearcs.php?code=2066#comments

thanks, how I do send commands to the PHP script, (that interacts with a database)

you would either send them via GET (passed via the URL as per the above example) or find a way to send POST headers (much more complicated but more flexible).

Etna might help:
http://repeatuntil.online.fr/Etna/

is it something like

www.mywebsite.com/gnet.php?get

to send a command?

It depends on what you mean by "command". Generally an url encoded parameter list looks something like this: www.mywebsite.com/gnet.php?parameter1=value1&parameter2=value2&parameter3=value3 etc...

I haven't looked at the gnet PHP script so can't be of much help there, sorry.

I have the source code for blitz3d Gnet,
now I know how to pass values hopefully I can work it out

ETNA was specifically designed for this: interaction with a php script which then interact with a mysql database. Advantage of ETNA: it uses threads, so the request do not slow down (or stop in fact) the program. Get it from my sig (it's free)...

thanks that does solve the slowdown problem.
any plans for a mac version?

Unfortunately (I am the first disappointed), this is not possible to have ETNA for Mac or Linux, because it is developped in PureBasic and uses dll.
ETNA will be multiplateform when Blitzmax will be multithreaded ;-) (which is not for tomorrow I believe)

Or if the creator of PB gets around implementing .SO and DynLib compile to be true multiplatform ;-)