About Store Forum Documentation Contact



Post Reply 
RakNet HTTPConnection Tutorial
Author Message
Driklyn Offline
Member

Post: #1
RakNet HTTPConnection Tutorial
I wrote a tutorial with source code provided on how to use the RakNet's HTTPConnection class to send POST/GET data to PHP forms. This is useful if you wish to use a MySQL database for your online game.

Excerpt:
"I spent most of this past weekend trying to figure out how to send POST/GET data to PHP forms in C++. After trying for quite a while to use WinINet or WinSock2 and getting pretty much nowhere, it suddenly occurred to me that perhaps RakNet, the server I am planning on using, had this functionality already built into it; and as it turns out, it does."

Tutorial:
http://www.esenthel.com/wiki/index.php?t...Connection

Download:
http://protocolic.com/source-code/_client.rar

You'll need to put the engine.pak file inside the Data folder. The project was created using VS2010 so you won't be able to compile using 2008 or lower without creating a new one, if you want to make changes to the source. However, the project is already pre-compiled, so just run the exe if you just want to test it.
(This post was last modified: 10-25-2010 07:48 AM by Driklyn.)
09-08-2010 04:55 AM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #2
RE: RakNet HTTPConnection Tutorial
Awesome! grin
09-08-2010 05:07 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
RE: RakNet HTTPConnection Tutorial
Thank you sir!
09-08-2010 05:11 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: RakNet HTTPConnection Tutorial
Thats pretty sweet! : )
09-08-2010 09:09 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: RakNet HTTPConnection Tutorial
Hey good job! thnx for sharing this... i will check this out later smile

There is always evil somewhere, you just have to look for it properly.
09-08-2010 01:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #6
RE: RakNet HTTPConnection Tutorial
Btw the download gives an error, so please fix the link smile

There is always evil somewhere, you just have to look for it properly.
09-22-2010 09:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #7
RE: RakNet HTTPConnection Tutorial
Yeah, thanks for noticing... Turns out my site was hacked. Several php files and all js files were infected. The infected files broke the site which is why the download wasn't working since I was using a WordPress plugin for that. Tried to fix it using a solution I found online but it didn't work, so I just deleted all my WordPress files.

I updated the download link in first post. Tutorial is down though.

I will likely just add the tutorial and the download to the wiki sometime soon.
09-22-2010 09:18 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #8
RE: RakNet HTTPConnection Tutorial
If anyone is interested you can also use EE::Download class for that:

Download d;
d.create("http://www.webestilo.com/en/php/ejem/procesa2.phtml?name=xxx&last=yyy");
09-29-2010 03:46 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #9
RE: RakNet HTTPConnection Tutorial
Finally got around to adding the article to wiki: RakNet: How to send POST/GET data using HTTPConnection.

(09-29-2010 03:46 PM)Esenthel Wrote:  If anyone is interested you can also use EE::Download class for that:

Download d;
d.create("http://www.webestilo.com/en/php/ejem/procesa2.phtml?name=xxx&last=yyy");

I originally tried using the Download class before going with RakNet, but I couldn't figure it out or at least didn't realize at the time. Seems pretty straight-forward though.

Would you be able to actually get the data as a string value so you could manipulate it though? An example of this could be perhaps retrieving a list of the top 100 user accounts of your game in order to use them for an in-game leaderboard.
10-25-2010 07:47 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #10
RE: RakNet HTTPConnection Tutorial
once download is finished
FileText f; f.readMem(d.data(),d.size());
f.getLine();
10-25-2010 11:05 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #11
RE: RakNet HTTPConnection Tutorial
Nice. I think that was the part I couldn't figure out. Thought the Download class was only for images. I think I'll add this to the wiki article cause it seems like a nice alternative.
10-25-2010 05:44 PM
Find all posts by this user Quote this message in a reply
Post Reply