How do i recreate a html request header?

I’m currently writing a Java Application that remotely controls my Roku. I found this website and used it to control my Roku. From Chromes developer tools i watched its data traffic and found the html request that controlled the Roku. The Header was this.

POST /keydown/Play HTTP/1.1
Host: 192.xxx.x.82:8060
Connection: keep-alive
Content-Length: 0
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Origin: http://remoku.tv
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://remoku.tv/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
I then tried to recreate this POST request within Java and it ended up looking like this:

HttpURLConnection urlConn;
URL url = new URL(“html://192.xxx.x.82:8060/keydown/Play”);
urlConn = (HttpURLConnection) url.openConnection();

urlConn.setRequestProperty(“Connection”, “keep-alive”);
urlConn.setRequestProperty(“Content-Length”, “0”);
urlConn.setRequestProperty(“Cache-Control”, “max-age=0”);
urlConn.setRequestProperty(“Accept”, “text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8”);
urlConn.setRequestProperty(“Origin”, “http://192.xxx.x.254”);
urlConn.setRequestProperty(“Upgrade-Insecure-Requests”, “1”);
urlConn.setRequestProperty(“User-Agent”,“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36”);
urlConn.setRequestProperty(“Content-Type”, “application/x-www-form-urlencoded”); 
urlConn.setRequestProperty(“Referer”, “http://192.xxx.x.254”);
urlConn.setRequestProperty(“Accept-Encoding”, “gzip, deflate”);
urlConn.setRequestProperty(“Accept-Language”, “en-US,en;q=0.8”);
I’m not 100% sure this is the correct way to recreate the request because it does not have the same effect as the the original (working). However, this may be because I changed a few minor details that may have actually be important. So my question to you is if this the correct way to recreate a request and if it is why is it not working? If not what is? Any help is appreciated

I’d post this in the Developer’s forum instead.

Most of those properties you’re setting are unnecessary. The one thing you do need that you’re missing is setRequestMethod(“POST”). I don’t do Java, so there may be other issues with your code.

Also, instead of using Chrome Developer Tools to determine the Roku interface, why not read the documentation: https://sdkdocs.roku.com/display/sdkdoc/External+Control+API

I agree with belltown.

Roku also has a bunch of free tools here - http://devtools.web.roku.com/
RemoteRoku is the first on the left, Deeplinker allows you to add fields in addition to contentID and Mediatype too.
I don’t think their tools allow much interaction (if any) with customizing headers in requests there, but they shouldn’t be needed except for perhaps the video playback tester tool, which includes a headers tab.
As for creating a header in the channel app, use AddHeader

If you set on using chromes developer tools, may I suggest right clicking on the data you are referring to and “copy as curl”