Jump to content

Is it possible to 'call' an autoitscript from javascript?


Recommended Posts

First, I would like to introduce the problem that I want to solve:

I would like to create a javascript code in a blogspot blog that checks some links of other sites to see if they are live.

Now, from what I read, I would need to call some server side scripting language like php -which would solve the checking of the sites by pinging them for instance- and then show the output in my blog using javascript but is it possible to make an autoitscript, upload it to a server and then 'echo' the result to a javascript?

Sorry for the concepts that I put in quotes, I have to admit that I am a beginner in some subjects and I will appreciate any guidance. Thanks!

Link to comment
Share on other sites

Edit:

Going to go with NO you cannot

....but....

http://status.4chan.org/ seems to do exactly what you are trying to do am i correct?

well it seems to be possible but not sure how they do it, being server side cant see the source. it is using the blogger system so yea...

ill do some researching and see what i can find

Edited by C45Y
http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun
Link to comment
Share on other sites

<script type="text/javascript">
var servers = {"www" : null, "boards" : null, "images" : null, "static" : null, "sys" : null, "rs" : null, "dis" : null};
var names = {"www" : "Front page", "boards" : "Boards", "images" : "Post images", "static" : "Static files", "sys" : "Posting", "rs" : "Rapidsearch", "dis" : "Discussion"};
var pingedservers = [];
var serverlist = document.createElement("ul");
var widget = document.getElementById("HTML1");
var subwidget = widget.getElementsByTagName("div")[0];

function color(s, n) {
    var classes = ["down", "maybe", "up"];
    var zomg = "sp"+"an";
    var spana = "<"+zomg+" class=" + '"';
    var spanb = '"' + '>';
    
    return spana+classes[n]+spanb+s+"</span>";
}

function isInArray(ar, o) {
    for (i = 0; i < ar.length; i++)
        if (ar[i] == o) return 1;
    
    return 0;
}

function check_servers() {
    for (serv in servers) {
        var sserv = servers[serv];
        var name = names[serv];
        var serv_up = isInArray(pingedservers, serv),
            sserv_up = isInArray(pingedservers, sserv);
        var l = document.getElementById("li_"+serv);
        var results = ["DOWN", "DOWN?", "UP"];
        
        l.innerHTML = color(name, serv_up*2)+" > "+color(results[serv_up * 2], serv_up*2);
    }
}

function server_is_up(server) {pingedservers.push(server);}

function add_server_check () {
    var scripts = document.createElement("div");
    subwidget.innerHTML = "";
    serverlist.className = "serverlist";
    subwidget.appendChild(serverlist);
    scripts.style.display="none";
    subwidget.appendChild(scripts);
    
    for (serv in servers) {
        var sserv = servers[serv];
        var l = document.createElement("li");
        var ping = document.createElement("script");
        var ping2;
        l.id = "li_"+serv;
        l.innerHTML = "Checking <strong>"+serv+"</strong>";
        
        ping.setAttribute("type", "text/javascript");
        ping.setAttribute("src",  "http://"+serv+".4chan.org/ping." + (sserv == "php" ? "php" : "js"));
        ping.id = "script_"+serv;
        
        if (sserv && sserv != "php") {
            l.innerHTML += " : <strong>"+sserv+"</strong>";
            ping2 = document.createElement("script");
            ping2.setAttribute("type", "text/javascript");
            ping2.setAttribute("src",  "http://"+sserv+".4chan.org/ping.php");
            ping2.id = "script_"+sserv;
        }
        
        serverlist.appendChild(l);
        scripts.appendChild(ping);
        if (ping2) scripts.appendChild(ping2);
    }
}

add_server_check();

window.onload = check_servers;

</script>

this is the javascript functions they are using to check if sites are up.

hope it helps

Edited by C45Y
http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...