# FHttpModule Usage Issues

**URL:** <https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, httprequest, unreal-engine, http, CPP, question\
**Created:** [January 28, 2015, 1:09pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250 "2015-01-28T13:09:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shepherd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shepherd](https://forums.unrealengine.com/u/Shepherd)\
**Post date:** [January 28, 2015, 1:09pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/1 "2015-01-28T13:09:19Z")

</div>

Hey All,

I have done the following:

```
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class Sandbox : ModuleRules
{
	public Sandbox(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP" });
        PrivateIncludePathModuleNames.AddRange(new string[] { "HTTP" });
	}
}

```

and in my wrapper header I have:

```
#include "Runtime/Online/HTTP/Public/Http.h"

```

However when attempting to use the following code:

```
TSharedRef<IHttpRequest> Request = (&FHttpModule::Get())->CreateRequest();

```

Visual studio is complaining about Get(); not being a member of FHttpModule…

I am coming from C# so I might be doing something wrong here as my C++ is a bit basic to say the least.

Is it possible for any of you to maybe help me out? I am using 4.6.1 and need to do some login code for my game that requires an http connection to my server.

---

<div class="post-metadata">

**Author:** ![trutty](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trutty](https://forums.unrealengine.com/u/trutty)\
**Post date:** [January 28, 2015, 2:51pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/2 "2015-01-28T14:51:08Z")

</div>

Use

```
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
```

 instead.  
VS is complaining at my side too, however it works anyway and also should regarding too the docs ([FHTTPModule](https://docs.unrealengine.com/latest/INT/API/Runtime/HTTP/FHttpModule/index.html)).

After that, you have to make your GET or POST request. Check out [IHttpRequest](https://docs.unrealengine.com/latest/INT/API/Runtime/HTTP/Interfaces/IHttpRequest/index.html) for more info.

```
Request->SetVerb(TEXT("POST"));
Request->SetURL("http://www....");
// setcontent-type to whatever you want
Request->SetHeader("Content-Type", "application/json");
Request->SetContentAsString("...");
...
// bind a function which gets called when the request is completed
Request->OnProcessRequestComplete().BindUObject(this, &Sandbox::completedHTTPRequest);
...
if (!Request->ProcessRequest())
{
	// HTTP request failed
}

```

The bind function would than look something like:

```
void Sandbox::completedHTTPRequest(FHttpRequestPtr request, FHttpResponsePtr response, bool bWasSuccessful)
{
        if (!response.IsValid())
    	{
    		// no valid response
    	}
    	else if (EHttpResponseCodes::IsOk(response->GetResponseCode()))
    	{
    		// valid response
    		FString msg = response->GetContentAsString();
    	}
    	else
    	{
    		// HTTP request error
    	}
}

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Shepherd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shepherd](https://forums.unrealengine.com/u/Shepherd)\
**Post date:** [January 28, 2015, 3:22pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/3 "2015-01-28T15:22:10Z")

</div>

Hi Trutty,

Thanks for taking the time to respond to my problem. Unfortunately this does not work for me.

using this: TSharedRef req = FHttpModule::Get().CreateRequest();  
results in the following errors:

error C2955: ‘TSharedRef’ : use of class template requires template argument list

error C2514: ‘TSharedRef’ : class has no constructors

According to the intelli hints I should be doing this: TSharedRef req

however it still leaves me with the ::Get(); that is not a member of FHttpModule.

This all results in a failed build sadly.

---

<div class="post-metadata">

**Author:** ![trutty](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trutty](https://forums.unrealengine.com/u/trutty)\
**Post date:** [January 28, 2015, 3:26pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/4 "2015-01-28T15:26:26Z")

</div>

sry, I meant

```
TSharedRef<IHttpRequest> req = FHttpModule::Get().CreateRequest();
```

. using the code tag resulted in deleting everything between “\<…\>”

does this work?

---

<div class="post-metadata">

**Author:** ![Shepherd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shepherd](https://forums.unrealengine.com/u/Shepherd)\
**Post date:** [January 28, 2015, 4:01pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/5 "2015-01-28T16:01:21Z")

</div>

Thanks Trutty!

Got it working 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3da1d5cd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3da1d5cd](https://forums.unrealengine.com/u/anonymous_user_3da1d5cd)\
**Post date:** [April 18, 2020, 4:50pm UTC](https://forums.unrealengine.com/t/fhttpmodule-usage-issues/305250/6 "2020-04-18T16:50:45Z")

</div>

i have similar issue, the code is directly from your wiki-archive.

includes:  
#include “Runtime/Online/HTTP/Public/Http.h”

line:  
TSharedRef \< IHttpRequest \> HttpRequest = FHttpModule::Get().CreateRequest();

cause:  
ompilerResultsLog: /home/nikolai/Dokumente/Unreal Projects/TP\_Android\_Test/Source/TP\_Android\_Test/BFL\_ServerCom.cpp:33: undefined reference to `FHttpModule::Get()’
