Any Tutorial for HTTP Functions in Lite-C? Simple Web functions?

Posted By: tolu619

Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/05/14 10:01

I googled "http functions tutorial in lite-c" but didn't get anything useful. Tried yahoo and bing too. I've seen from the manual that lite-c has functions such as http_proxy and http_sendpost but I can't find any tutorials to show me how and how not to use them. My game has no online multiplayer but I need it to be able to communicate with my website to check for news, updates and allow the purchase of add-on content.
Posted By: Superku

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/05/14 10:25

http://www.conitec.net/beta/http.htm

As you can see this is a "Pro" only feature. You will either need to upgrade to Pro or use/ buy some other multiplayer/ internet plug-in (ANet or whatever it is called, or GSTnet (?)).
Posted By: tolu619

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/05/14 10:46

Wow. Ouch. My commercial editions still has limitations in such a major area?
Posted By: Reconnoiter

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/05/14 10:55

Sadly yes, they really should add those things to commercial edition. Since from the 'features list' by Conitec, it looks like commercial has everything for an average online mp game. But that is misleading, because as you said not the necessary functions to communicate with websites (for e.g. a server browser, a very important feature for mp games).
Posted By: Talemon

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/07/14 07:12

I'm not sure what version has what limitations but you can easily integrate cURL into the engine. I just modified the libcurl source to include engine bindings and i call its functions using curl guides.
check it out at: http://curl.haxx.se/libcurl/

The engine also uses libcurl for its http functions anyway, acknet is built with it statically.

I can share the project if you need it when I have some time.
Posted By: Reconnoiter

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/07/14 11:21

Yeah great Talemon, I would be interested in that laugh.
Posted By: tolu619

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/09/14 13:45

Originally Posted By: Talemon
I'm not sure what version has what limitations but you can easily integrate cURL into the engine. I just modified the libcurl source to include engine bindings and i call its functions using curl guides.
check it out at: http://curl.haxx.se/libcurl/

The engine also uses libcurl for its http functions anyway, acknet is built with it statically.

I can share the project if you need it when I have some time.


Oh, please do. You'll make the world a better place!
Posted By: Talemon

Re: Any Tutorial for HTTP Functions in Lite-C? Simple Web functions? - 07/10/14 06:45

Hey guys, I'm not sure about the legality of distributing the libcurl project here so I'm just going to explain what you need to do:

1. Download libcurl source code( http://curl.haxx.se/download.html ) and extract it somewhere
2. Download CMake and use it to create an MS Visual Studio solution of libcurl
3. Copy and add these files from GStudio8\sdk_plugin folder to the libcurl project:
- adll.cpp
- adll.h
- afuncs.h
- atypes.h
- avars.h
- cmd.h
4. Copy adll.lib to somewhere accessible from the project and make the project link against it by adding it to the "Additional Dependencies" at Project Properties/Linker/Input
5. Add these two files to the project as well:

main.h
Code:
#include<Windows.h>
#define DLL_USE
#include "gstudio/adll.h" // depends on where you placed adll.h



main.c
Code:
#include "main.h"

BOOL APIENTRY DllMain( HANDLE hModule,	DWORD  ul_reason_for_call,	LPVOID lpReserved )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	// make sure the library is linked
	engine_bind();
	return TRUE;
}



If everything goes well, you'll get a libcurl.dll you can plug into the engine! You'll need to define the functions you use in you game code and also you'll need to derive some of the #defines from the libcurl source code because they're defined via a macro.

Here is the header file I've prepared to use libcurl in our game code:
http://pastebin.com/n9m8mqag
© 2024 lite-C Forums