I’ve never done anything network-related with UDK. I do have Steamworks working, but anything Steamworks does is behind the scenes in steam_api64.dll. I’d like to use a web API (Twitch, specifically) and I’m wondering if UDK has built-in functionality for sending arbitrary string to any URI and listening for a response. Thank you for any information you can send me.
Edit: I don’t know if UDK has this built-in, but maybe this is what I should use instead just because I already have a working Steamworks integration. ISteamHTTP Interface (Steamworks Documentation) Any thoughts about that?
Yes, you can use the HttpRequestInterface class provided in Unrealscript. Example:
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//Send request to a url.
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function RetrieveDataStoreFromWeb()
{
local HttpRequestInterface Request;
request = class'HttpFactory'.static.CreateRequest();
request.SetHeader("X-Game-Agent", "game=MyGame, engine=UE3, version=1.1");
request.SetURL("http://www.yourUrl.com");
request.SetVerb("GET");
request.SetProcessRequestCompleteDelegate(HtttpRequestComplete);
request.ProcessRequest();
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//Handle the response.
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function HtttpRequestComplete(HttpRequestInterface request, HttpResponseInterface response, bool bWasSuccessful)
{
local String responseStr;
if (bWasSuccessful) {
responseStr = response.GetContentAsString();
}
//Do whatever with the response string...
}
I use this for things like managing servers that i flag as “verified”, etc.
2 Likes