0
Completed

Where to put the cookie parameter while sending HTTP commands??

Abhijeet Ramgir 5 years ago in Products / AV & Custom Systems updated by oggi katic 4 years ago 10
Hey,

I have been trying to get Iridium to work with the Sony tv, and the tv requires HTTP to communicate via IP, but I have to put a cookie which makes the connection possible. Can you please tell me where I can put the cookie in Iridium GUI editor?

Thanks,
Abhijeet

Completed
Hello Abhijee

You cannot add the cookie in iRidium now, this function is not implemented. We plan to add it in the next versions.
Hello Abhijee!

if you not use https protocol (only http) then you can simulate cookie by TCP driver. To simulate write full request in the string, for example:

var Data = "GET http://www.site.ru/news.html?login=Petya%20Vasechkin&password=qq HTTP/1.0\r\n Host: www.site.ru\r\n Referer: http://www.site.ru/index.html\r\n Cookie: income=1\r\n \r\n";

Driver.Send[Data];
Hey Sergey,

This is the link for the Sony tv http commands: http://www.openremote.org/display/forums/Sony+TV+HTTP+control


Could you please take a look at the link and determine if it's http protocol or only http.
I'm using A/V and custom driver (http), and it's http post and I have to include a cookie parameter for authentication with the tv.

Please help me out with this, I'm trying to impress my boss with the capabilities of Iridium, but not having a cookie parameter makes it difficult to convince.


Thanks a lot,
Abhijeet.
Hi, Abhijeet!

The TV communicate with http protocol. But if you want to control with iRidium in currrent version then it will be not easy.

You can try to adapt this code to iRidium API:
https://github.com/shabunin/cf-sonytv/blob/master/scripts/SonyTV.js

To generate http request by manual, you can use this tool:
http://requestmaker.com/

if you not have best skill in the java script then may be best way is stop this task.
Hey Sergey!

Is there a way to send a POST command to the device using this example you gave, with all the information we have about the Sony TV http post:

var Data = "GET http://www.site.ru/news.html?login=Petya%20Vasechkin&password=qq HTTP/1.0\r\n Host: www.site.ru\r\n Referer: http://www.site.ru/index.html\r\n Cookie: income=1\r\n \r\n";
Driver.Send[Data];

I have learnt JavaScript, but the code you gave is a bit too complicated. I can send a command like the example above, if you could just show me what a POST command would look like with parameters like URL, Data and cookie.
I would really appreciate it!

Thanks a lot,
Abhijeet


Hey Sergey,

Please help me out!

Thanks,
Abhijeet.

Hey Abhijeet.


Did you got your Sony TV work ?

Hi,

It is a syntax example to send Cookie by TCP Driver.


var post = '{"Data1": "value1","Data2":"'value2"}';

var packet = 'POST ' + '/news.html' + ' HTTP/1.0\n' +
'Host: ' + 'www.site.ru'+ ':' + '80' + '\n'+
'Connection: keep-alive\n'+
'Content-Type: application/json\n'+
'User-Agent: Mozilla/3.0 (compatible; Indy Library)\n'+
'Accept-Encoding: identity\n'+
'Content-Length: '+ post.length + '\n\n' + post + '\n' +
'Cookie: income=1';

var Driver = IR.GetDevice("AV & Custom System TCP");

Driver.Send[packet];