What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Using PHP files

[Request] Using PHP files
Author: Message:
hackrash
New Member
*


Posts: 2
Joined: May 2009
O.P. [Request] Using PHP files
Hello! I am new in this forum.

I was trying to make a script which sends a MMS to my Mobilephone when my status is AWAY and I receive a message. I've got my php script and it works in this way:

http://"mysite".org/mms.php?nick=sender&rcpt=number&text=Message


Moreover i've read someone used this:

function SendToPHP(email,msg){
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
with(xmlhttp){
setRequestHeader("email",email);
setRequestHeader("message",msg);
onreadystatechange = function(){if(readyState==4 && status!=200)  Debug.Trace("ERROR!\n\n email: "+email+"\n\n message"+msg);};
open("POST", /*make sure you defile this variable*/ url,true);
send(null);
}
}

Can you help me?
05-13-2009 10:55 AM
Profile E-Mail PM Find Quote Report
rtsfg
New Member
*

Avatar

Posts: 8
33 / Male / Flag
Joined: Mar 2009
RE: [Request] Using PHP files
try this:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
if(Messenger.MyStatus == 6 || Messenger.MyStatus == 7)
new ActiveXObject("WScript.Shell").run("http://yoursite.org/mms.php?nick="+Origin+"&rcpt=number&text="+Message);
}

You may get problems with this, because the Message might be in a format that doesn't work as part of an url.

You could add some string manipulation lines then.
05-13-2009 11:39 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: [Request] Using PHP files
quote:
Originally posted by rtsfg
You may get problems with this, because the Message might be in a format that doesn't work as part of an url.

Using a urlencode function on either script should make it safe to use...
<Eljay> "Problems encountered: shit blew up" :zippy:
05-13-2009 12:38 PM
Profile PM Find Quote Report
hackrash
New Member
*


Posts: 2
Joined: May 2009
O.P. RE: [Request] Using PHP files
Thanks. But with your code I receive only the first word of the message.

I had already done something like this:

new ActiveXObject("WScript.Shell").Run(iexplore "http://mysite.org/mms.php?nick="+ sender +"&rcpt="+number+"&text="+Message);

and it worked good. The problem is that it works only with Internet Explorer and when i receive a message on MSN and my status is "AWAY", a window of Internet Explorer appears, but then it doesn't disappear.
05-13-2009 01:43 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Request] Using PHP files
http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx

Best to use Ajax for this. Or atleast you can use ShellExecuteEx
05-13-2009 01:52 PM
Profile E-Mail PM Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
37 / Male / Flag
Joined: Jul 2003
RE: [Request] Using PHP files
I made a script to do this for myself a while ago, this should start you off:

code:
//////////////////////////////////////////////////////////////////////////////////////
//////                                                  //////   
//////                        AwaySMS                      //////
//////                                                  //////   
//////////////////////////////////////////////////////////////////////////////////////

var myPhone = "01234567890";
var sUser = "usernmae";
var sPass = "password";
var whitelist = Array();
whitelist[0] = "email@hotmail.co.uk";       
whitelist[1] = "emailone@hotmail.com";           
whitelist[2] = "emailtwo@hotmail.com";           
whitelist[3] = "email3@hotmail.com";       
whitelist[4] = "emailfour@hotmail.com";   
whitelist[5] = "email5@hotmail.com";       
whitelist[6] = "emailsix@hotmail.com";       
whitelist[7] = "emailseven@hotmail.com";   
whitelist[8] = "emaileight@hotmail.co.uk";

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  if ((Origin.indexOf('(')==0)&&(Origin.indexOf(':')!=-1)&&(Origin.indexOf(')')!=-1)){
    var sOrigin = Origin.substr(Origin.indexOf(')')+2);
  }else{
    var sOrigin = Origin;
  }
  if((sOrigin != Messenger.MyName) && (MessageKind == MSGKIND_SAYS)){
    if(Messenger.MyStatus == STATUS_AWAY || Messenger.MyStatus == STATUS_IDLE)
    {
      for(var e = new Enumerator(ChatWnd.Contacts);!e.atEnd();e.moveNext()){
          var Contact = e.item();
          if (Contact.Email != Messenger.MyEmail){var sEmail = Contact.Email;}
      }
         for (i = 0; i < whitelist.length; i ++) {
        if(whitelist[i] == sEmail)
        {
          SendMsg(sEmail, Origin, Message);
        }
      }
    }
  }
}

function SendMsg(Email, Name, Message)
{
    var sSender = Email.substr(0,Email.indexOf('@'));
    if ((Name.indexOf('(')==0)&&(Name.indexOf(':')!=-1)&&(Name.indexOf(')')!=-1)){
        var sName = Name.substr(Name.indexOf(')')+2,20);
    }else{
        var sName = Name.substr(0,20);
    }
    var sMsg = sName + ' (' +sSender + '):  ' + Message;
    Debug.Trace(sMsg);
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var sURL = "http://www.50sms.com/multi.php?login="+sUser+"&password="+sPass+"&phones="+myPhone+"&message="+sMsg+"&originator=AwaySMS";
    xmlhttp.open("GET",sURL, true);
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState==4) {
        var sRet = xmlhttp.responseText;
        if (sRet.indexOf('<result>OK</result>')!=-1){
             MsgPlus.DisplayToast("AwaySMS", "SMS Sent");
        }else{
          MsgPlus.DisplayToast("AwaySMS", "Error Sending SMS");
        }
       }
    };
    xmlhttp.send();
}

You may want to change it, as this is what it does currentley:
  • Works with 50sms.com - Can easily be changed
  • Only sends messages when my status is idle
  • Only sends me a message when whitelisted emails contact me
  • Shows the display name and start of email address

SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
05-13-2009 02:26 PM
Profile E-Mail 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