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:
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. [Req] Touch/ping a URL
Hey all you budding script developers!

I was wondering if any of you would be interested in making a script that executes a php file on a remote site every time I either sign in and/or come out of offline status.

I don't need a flashy GUI, just a place to put the URLs in a variable list or array in the code is fine. Oh, and I might need to use more than one URL, so adding it to an array sounds like a good option.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
05-28-2007 10:45 PM
Profile PM Web Find Quote Report
Dennis Mike
Junior Member
**

Avatar

Posts: 59
Reputation: 2
34 / Male / –
Joined: Jan 2007
RE: [Req] Touch/ping a URL
good idea
05-28-2007 10:54 PM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / 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
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. RE: [Req] Touch/ping a URL
Thanks ezra! I was thinking all statuses except for 2 - offline instead of just online status. I don't need to send status or username or whatever, just need to run the script

This post was edited on 05-30-2007 at 08:28 PM by MeEtc.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
05-30-2007 08:26 PM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: [Req] Touch/ping a URL
Changed the parts below to remove sending the statuses and email address to the server. Now it's just a "ping" :-)

code:
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.
  //Removed sending the status, just a ping is good.
  ping();
}

function OnEvent_MyStatusChange(NewStatus)
{
  //Ping the server.
  ping();
}

function ping()
{
  //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]);
      //Open a connection to the server.
    xmlhttp.open("GET", linkarr[link], true);
    //Send nothing, this just creates the actual connection to the server and the params are send as GET params.
    xmlhttp.send();
  }
}

To add things like a ping on signout just add the correct Events and call the ping function from there.
[Image: 1-0.png]
             
05-30-2007 10:47 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


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