Home AMX User Forum NetLinx Studio

Launch function on a web server

Hi guys,

I need a small help,

On a IP power switcher, I need to fire 2 function present in the HTML code of it's web server, can this be possible from Netlinx ? if possible I would like to don't use duet.

Thanks,

Criss


this are the function and attached the complete source code
function GetGroupOn()
{
var s = '';
var i = 1;
//for(var i = 1; i < 3; i++)
for(var j = 1; j < 9; j++)
{
if( document.getElementById('C'+ i + j).checked )
s += 1;
else
s += 0;
}
s += "00000000" + "00000000";
if(confirm("turn on the outlet"))
newAJAXCommand('ons.cgi?led='+s, null, false);
}

function GetGroupOff()
{
var s = '';
var i = 1;
//for(var i = 1; i < 3; i++)
for(var j = 1; j < 9; j++)
{
if( document.getElementById('C'+ i + j).checked )
s += 1;
else
s += 0;
}
s += "00000000" + "00000000";
if(confirm("turn off the outlet"))
newAJAXCommand('offs.cgi?led='+s, null, false);
}

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    You should be able to just connect to port 80 of the unit and request the appropriate url. The page to request is going to be something like: "'ons.cgi?led=',someValue". I am not sure of the exact format as I would need more of the web page code, but it would be much easier for you to use FireBug or something similar to grab the actual page request. Since you just want to activate the function, you don't even need to parse the response.

    There are other threads that talk about creating GET requests to web servers.

    Jeff
  • Thanks man, i will give it a try!
  • It works like a charm! Many thanks for the help!
Sign In or Register to comment.