Firing GPI Triggers

From Harris, 2/17/2011…

URL to fire GPI #5 looks like this:

http://localhost:8009/maxidrivers/maxisoftgpi/fire?gpi=5

Replace 'localhost' with the name of the host, if you're doing it remotely. And of course, replace '5' with the # of the GPI to fire. Post anything you want to that URL, and it goes.

You issue an HTTP POST request the Phoenix HTTP server port, which is usually: localhost:8009 The resource path is: /maxidrivers/maxisoftgpi/fire you issue it with a query of gpi=x where x is the number of the GPI you want to fire

You can create a new “fire webpage” calling the fire links anything you want, just have them call the above mentioned URL to fire the trigger.

You can also invoke the function: fire(x) …in the javascript hosted at http://localhost:8009/maxidrivers/maxisoftgpi/main.js

Or, if you need to completely do it yourself I can send you the code.

Sample javascript to invoke an http POST request:

function fire(gpi_index)
{
    method="POST";
    url="http://localhost:8009/maxidrivers/maxisoftgpi/fire?gpi=" + gpi_index;
    async = false;
    send = '<?xml version="1.0" encoding="ISO-8859-1"?><status></status>';//courtesy of your friendly neighborhood spider men

    if (window.ActiveXObject) {
        // MS IE
        try
        {
            var httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            httpRequest.Open(method, url, async);
            httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            httpRequest.Send(send);
        }
        catch (e)
        {
            return ("Error: " + url + "\n" + e);

        }
    } else if (window.XMLHttpRequest) {
        // Not MS IE
        try
        {
            var httpRequest = new XMLHttpRequest();
            httpRequest.open(method, url, async);
            httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            httpRequest.send(send);
        }
        catch (e)
        {
            return("Error: " + url + "\n" + e);
        }
    }