[Request] Using PHP files - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Request] Using PHP files (/showthread.php?tid=90617)
[Request] Using PHP files by hackrash on 05-13-2009 at 10:55 AM
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?
RE: [Request] Using PHP files by rtsfg on 05-13-2009 at 11:39 AM
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.
RE: [Request] Using PHP files by Spunky on 05-13-2009 at 12:38 PM
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...
RE: [Request] Using PHP files by hackrash on 05-13-2009 at 01:43 PM
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.
RE: [Request] Using PHP files by matty on 05-13-2009 at 01:52 PM
http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx
Best to use Ajax for this. Or atleast you can use ShellExecuteEx
RE: [Request] Using PHP files by Dempsey on 05-13-2009 at 02:26 PM
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
|