What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Req] Touch/ping a URL

[Req] Touch/ping a URL
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
38 / Male / Flag
Joined: Mar 2003
RE: [Req] Touch/ping a URL
I felt bad that noone made it for you yet, so I made a quick thingy

code:
var xmlhttp;

var linkarr = new Array();

//Here we fill the array with the addresses we will be "pinging", just add more .push statements to add more servers.
linkarr.push("http://www.testserver.com/ping.php");
linkarr.push("http://www.testserver2.com/ping2.php");

function OnEvent_Initialize(MessengerStart)
{
  //Create the XMLHTTP object we will be re-using the entire time the script runs.
  xmlhttp = new ActiveXObject("Microsoft.XmlHttp");
}

function OnEvent_Uninitialize(MessengerExit)
{
  //Delete the XMLHTTP Object, not really necassary as the Garabage Collector will clean it up too.
  delete xmlhttp;
}

function OnEvent_Signin(Email)
{
  //Status Change is not called when we sign in so here's a seperate function to ping when we sign in.
  //The three means "Online", see Scripting Docs for full explanation of statusCodes.
  ping(3);
}

function OnEvent_MyStatusChange(NewStatus)
{
  //Ping the server and send the new status too.
  ping(NewStatus);
}

function ping(NewStatus)
{
  //Here we will be sending the actual pings.
  var link;
  //Create a so called foreach loop to loop trough all the servers in the array.
  for (link in linkarr)
  {
    //Debug.Trace("  linkarr::linkarr[" + link + "] = "  +linkarr[link]);
    //Debug.Trace("  param::" + "?email=" + Messenger.myEmail + "&NewStatus=" + NewStatus);
    //Open a connection to the server.
    xmlhttp.open("GET", linkarr[link] + "?email=" + Messenger.myEmail + "&NewStatus=" + NewStatus, true);
    //Send nothing, this just creates the actual connection to the server and the params are send as GET params.
    xmlhttp.send();
  }
}

WDZ, code coloring please :'(
[Image: 1-0.png]
             
05-30-2007 06:09 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Req] Touch/ping a URL - by MeEtc on 05-28-2007 at 10:45 PM
RE: [Req] Touch/ping a URL - by Dennis Mike on 05-28-2007 at 10:54 PM
RE: [Req] Touch/ping a URL - by Ezra on 05-30-2007 at 06:09 PM
RE: [Req] Touch/ping a URL - by MeEtc on 05-30-2007 at 08:26 PM
RE: [Req] Touch/ping a URL - by Ezra on 05-30-2007 at 10:47 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On