Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Using HTTP to access the internet.

Author
Message
Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 22nd Feb 2008 21:33
Has Any one been able to find a way to use an http call to a webserver
running some sort of backend (php , mysql) to return data ?

and use the returned data within Dark Gdk ? if so how id be most interested

Please note i dont use the .net stuffs ( i dont actually understand the diffrence much )

Example: Say im creating an online game, where my database is saved into a mysql databse so that the website can also use that data easily ( online account management, tie in forum names with game accounts and such ) and want to check that database when a user logs into mygame,

i could have the game send a http request to a php script located on a webserver using post variables ( part of a http request ) to supply username and password, the php script checks with the databse and returns for example 1 for player allowed to login and related data, or 0 and the error message, as a web page would but without a gui.

I hope this make sense with someone just ive had a few to drink

Stuck in the land of the confused! and loving it!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Feb 2008 04:57
Use Winsock DLL - Port 80 unless using SSL 0 then you need to look it up cuz I forget - its google away....

You want a persistant connection usually - you need to build a HTTP HEADER - its a request - its funny too because you get to name your software in the header - I used to get a kick of messing with people's STAT Software - cuz they See: IE Mozille, Netscape, Opera, FireFox, Hi Mom.... Hi Mom? WTF LOL

Once the hit is made - you poll (or set up an event handler thats called when data is coming back at ya) for when the data is ready - its pure text - then you need to parse through the returned junk until you get the data you want.

I have some FreePascal Source with the HTTP header stuff and the Return Formats I think - as for accessing the Win sock - check this out:
(Not my code but good little helper ref for winsock)

Quote: "Sure, here's a little example of how to set up a basic single-client server. Open command prompt and type telnet 127.0.0.1 1337 to connect to it.
"




Hope that gives you some idea of how it's achieved.

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Feb 2008 09:50 Edited at: 23rd Feb 2008 10:26
The easiest way to do this is to use URLDownloadToFile, passing GET values to send data to the server. However that's not very secure, so I'd suggest you use the WinHTTP API.

Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 24th Feb 2008 01:01
~Thanks for the advice im creating my own simple wrapper to do this currently, One thing to note for others is the reason why using GET querys are unsafe,

Compare these two url's both could send the same data, what would you choose in your application,


http://someurl.com/login.php?result=failed - Get
http://someurl.com/login.php - Post

Now appart from the obvious way of Injecting code into Get arrays

http://someurl.com/login.php?result=Success - Lol i just haxxord the website

Post arrays offer some form of protection as the data is at least hidden to the normal user base of the site

so thats why POST > GET.

Anyways back on topic..

thanks again fo the response and expect an easy to use Http: request class coming soon !

Also if i was to do the core of the work, would anyone be willing to give it a look over and a quick look at speeding things up ?

i can get it working, but getting it optimised is outta my league.

Stuck in the land of the confused! and loving it!

Login to post a reply

Server time is: 2024-11-20 03:40:38
Your offset time is: 2024-11-20 03:40:38