How to with ASP and XMLHTTP
I am trying to access with the following code, but get an error:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "POST", "https://www.imified.com/api/bot/", False,"username", "password
xml.setRequestHeader "Authorization", "Basic " & base64_encode("username;password")
xml.Send "botkey=botkeygoeshere&apimethod=getAllUsers"
Response.Write xml.responseText
Support Staff 2 Posted by Danté Vitulano on 26 Apr, 2010 12:34 PM
Hello,
I am afraid that I am not terribly familiar with ASP myself, but if you can tell me exactly what error you are getting, I may be able to determine what the cause is.
~Dante
3 Posted by VictorB on 26 Apr, 2010 02:19 PM
4 Posted by Dave Hoff on 27 Apr, 2010 05:40 PM
Not sure what is going on here. I have tested the getAllUsers API call and
it is working as it should. That error is returned only when the username,
password, and botkey do not validate.
Dave
5 Posted by Victor Brief on 27 Apr, 2010 06:02 PM
And what code are you using? Do you have a sample.
6 Posted by Dave Hoff on 29 Apr, 2010 04:34 PM
We have a PHP sample on the docs page. I don't have an IIS server to test
this with but as long as your using basic auth correctly it should work.
7 Posted by Victor Brief on 29 Apr, 2010 04:48 PM
The PHP version of the code works, but the ASP doesn't, hence my support
question.
8 Posted by rob on 12 May, 2010 01:53 AM
Hi Guys,
I might be able to help -- I've put together a sample poster.
I believe the trick was setting the correct content-type. Railo? must not be able to understand the post if it's not specified.
I've attached the sample in classic asp, and i've tested it. Of course, now i feel slightly dirty as i haven't wrote new asp in about 8 years.
Cheers,
Rob.
== ps, here is the snippet, in case you dont want to download this:
9 Posted by mlucas on 19 Oct, 2010 03:28 PM
@Victor Brief Did the code that "rob" posted help? Is this still a current issue that you are having? I will be monitoring this page and look forward to helping you with your issue.
-Matt Lucas
IMified Support
10 Posted by Stephen Connell on 20 Feb, 2011 05:56 PM
To get the sample code to work i had to add an equals sign to the end of the string provided by the base64_encode function.
I added & "=" to the end of this line:
xml.setRequestHeader "Authorization", "Basic " & base64_encode(imifiedUsername & ":" & imifiedPassword) & "="and the code worked properly.
Thanks, Stephen
11 Posted by jkulnis on 27 Feb, 2011 02:56 PM
Using Classic ASP, i get a 200 response but no text going out to the phone number. Any assistance would be nice. thanks.
var objHTTP = Server.CreateObject("MSXML2.XMLHTTP");
var vURL = "https://www.imified.com/api/bot/"
var vBotAll = "botkey=MyBotKey&apimethod=send$user=MyCellNo&msg=MyMsg
objHTTP.Open("POST", vURL, false)
objHTTP.setRequestHeader("Authorization", "Basic " + "MyUser:MyPassword") // This is replaced with the encode but Imified doesnt give me a user name so assuming it is my email address
objHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
objHTTP.Send(vBotAll)
objHTTP = null
12 Posted by Dave Hoff on 07 Mar, 2011 04:01 PM
Do you get back the expected xml response in the body from IMified?
On Sun, Feb 27, 2011 at 9:56 AM, jkulnis <
***@tenderapp.com> wrote: