# Work with the HTTP protocol in UE4

**URL:** <https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, unreal-engine, http, CPP, question\
**Created:** [August 12, 2014, 9:49am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759 "2014-08-12T09:49:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ferox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ferox](https://forums.unrealengine.com/u/Ferox)\
**Post date:** [August 12, 2014, 9:49am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/1 "2014-08-12T09:49:04Z")

</div>

How do I download code page from the Internet using HTTP.

```
UObject* WorldContextObject;
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject);
UServerLoader* obj = (UServerLoader*)StaticConstructObject(UServerLoader::StaticClass());
TSharedRef< IHttpRequest > HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetVerb("GET");
HttpRequest->SetURL(FString("http://example.com"));
HttpRequest->OnProcessRequestComplete().BindUObject(obj, [](FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful) {
	if (!bWasSuccessful)
	{
		UE_LOG(LogTemp, Error, TEXT("Response was invalid! Please check the URL."));
		return;
	}
	FString responseData = Response->GetContentAsString();
});
HttpRequest->ProcessRequest();

```

This code produces the error. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![jmietola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jmietola](https://forums.unrealengine.com/u/jmietola)\
**Post date:** [August 12, 2014, 7:51pm UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/2 "2014-08-12T19:51:22Z")

</div>

This is a bit off-topic but how did you managed to get HTTP work? I get FHttpModule is undefined eventhough I added these two line in Project.Build.cs

```
    PrivateDependencyModuleNames.AddRange(new string[] { "HTTP" }); 
    
    PrivateIncludePathModuleNames.AddRange(new string[] { "HTTP" });

```

and of course included http.h.

---

<div class="post-metadata">

**Author:** ![Ferox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ferox](https://forums.unrealengine.com/u/Ferox)\
**Post date:** [August 13, 2014, 7:15am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/3 "2014-08-13T07:15:33Z")

</div>

I also included http.h and added HTTP module and I were errors during compilation. How can I get the HTML source of page with this module?

---

<div class="post-metadata">

**Author:** ![jmietola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jmietola](https://forums.unrealengine.com/u/jmietola)\
**Post date:** [August 13, 2014, 8:52am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/4 "2014-08-13T08:52:03Z")

</div>

I actually had wrong http.h included so I used this to get it work.

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

```

,I

---

<div class="post-metadata">

**Author:** ![Ferox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ferox](https://forums.unrealengine.com/u/Ferox)\
**Post date:** [August 13, 2014, 10:12am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/5 "2014-08-13T10:12:11Z")

</div>

What have you wrote in the code to download HTML page from the Internet?

---

<div class="post-metadata">

**Author:** ![jmietola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jmietola](https://forums.unrealengine.com/u/jmietola)\
**Post date:** [August 13, 2014, 10:26am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/6 "2014-08-13T10:26:47Z")

</div>

I’m currently doing HTTP POST requests only.

---

<div class="post-metadata">

**Author:** ![jmietola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jmietola](https://forums.unrealengine.com/u/jmietola)\
**Post date:** [August 13, 2014, 10:28am UTC](https://forums.unrealengine.com/t/work-with-the-http-protocol-in-ue4/290759/7 "2014-08-13T10:28:03Z")

</div>

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

Trying to follow the  
UE4与WEB服务器交互(json)
