This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Write a code from LM3, to send HTTP commands to a device to control it
#1
Hi everybody! Please help me...please.!
I tried with it, but all failed...
Sad
I have a line:
http://100.100.100.9/send.htm?remote=sam...mand=power
And I need to write a script  used LM3, to send HTTP commands to a device to control it
That is Irtrans. Big Grin
Please help me.  Heart Heart  Thank you very much...All
Reply
#2
This should do it. You will see the result of this request in "Logs" tab.

Code:
require('socket.http')
url = 'http://100.100.100.9/send.htm?remote=samsungtv&command=power'
res, err = socket.http.request(url)
log(res, err)
Reply
#3
(18.09.2015, 06:11)admin Wrote: This should do it. You will see the result of this request in "Logs" tab.

Code:
require('socket.http')
url = 'http://100.100.100.9/send.htm?remote=samsungtv&command=power'
res, err = socket.http.request(url)
log(res, err)

Thank admin. But I did try and error:  Sad
* arg: 1
 * nil
* arg: 2
 * string: No route to host


So why do it?..although, I typed in the address bar of Chorme still works
'http://100.100.100.9/send.htm?remote=samsungtv&command=power'
Please help me...Sad thank all  Heart
Reply
#4
Check network settings in System Config -> Network -> Interfaces -> eth0. You have to set Gateway IP to your router IP, otherwise LogicMachine will only have access to devices in the same local network, but not outside.
Reply
#5
Heart 
Blush Heart ! Thank Admin and everyone. 
I 've done . I succeeded!
Thank all!
Reply
#6
(22.09.2015, 12:03)phongvucba Wrote: Blush Heart ! Thank Admin and everyone. 
I 've done . I succeeded!
Thank all!





sr. ai đấy nhỉ?
Reply
#7
(28.09.2015, 09:14)Hoang189 Wrote:
(22.09.2015, 12:03)phongvucba Wrote: Blush Heart ! Thank Admin and everyone. 
I 've done . I succeeded!
Thank all!

Anh Phương mà!



sr. ai đấy nhỉ?
Reply


Forum Jump: