Shoutbox

[help!] XML HTTP - 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: [help!] XML HTTP (/showthread.php?tid=76936)

[help!] XML HTTP by rob_botch on 08-22-2007 at 02:15 PM

Hello!

I am writing a script to upload a message to stikkit. I have used the following code, but the script debugging window always says that "access is denied" on line 24 when the code is executed.

code:
function Stikk(note)
{
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
    xmlHttp.open("POST", "http://api.stikkit.com/stikkits.atom", false);
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    Debug.Trace("raw_text="+note+"&apikey="+APIKey);
    xmlHttp.send("raw_text="+note+"&apikey="+APIKey); <-- Line 24

    MsgPlus.DisplayToastContact("Stikkit Live!","[c=46]Stukk[/c]\n", note);
}

Any help would be much appreciated!

Thanks

Robert
RE: [help!] XML HTTP by Ezra on 08-22-2007 at 02:43 PM

try not using a specific version of msxml but just use "MICROSOFT.XMLHTTP", that will let windows choose the newest version it has installed.

That might solve it.


RE: [help!] XML HTTP by Matti on 08-22-2007 at 02:45 PM

First of all, use "Microsoft.XMLHTTP" instead of "Msxml2.XMLHTTP.3.0". It's strongly recommended that you try not to use version numbers in ActiveXObject references, and with "Microsoft.XMLHTTP" you're guaranteed that it'll always use the latest version.

Secondly, where did you define APIKey?

Apart from these remarks, I don't see the problem... :-S

EDIT: Blah, Ezra beat me. :P


RE: [help!] XML HTTP by rob_botch on 08-22-2007 at 02:45 PM

Thank you, but I'm afraid it doesn't solve the problem. I still get the following error message in the debug console:

code:
Error: Access is denied.
(code: -2147024891)
       File: Stikkit Live!.js. Line: 24.


EDIT: APIKey is defined outside of any functions. It is correctly inserted into the debugging line directly above the problem line. One thought, do I need to define a connection to the internet?
RE: [help!] XML HTTP by Felu on 08-22-2007 at 04:42 PM

http://api.stikkit.com/stikkits.atom requires login. Without that you won't be able to access the url. Use something like http://user:password@api.stikkit.com/stikkits.atom that'd work i guess. Access Denied is maybe some 403 error.

Btw also try setting Request Headers, might work [Image: msn_happy.gif].


RE: [help!] XML HTTP by rob_botch on 08-22-2007 at 04:48 PM

Thanks everybody for the pointers. Actually, I've just discovered and solved the problem. It was my own stupidity which caused the problem: apikey is actually api_key. If only JScript had stikkit's levels of free text compatability... :P


RE: [help!] XML HTTP by Spunky on 08-22-2007 at 08:30 PM

I got this message when I was developing a script and it turned out to be because I was using a query string with more than one variable in it...