• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1306
  • Last Modified:

Problem posting form data to URL with XMLHTTP

I have a short script that is attempting to send form data to an external URL via XMLHTTP to trigger an SMS message. Now when this is run the SMS message is received, so the data is clearly being sent however I get a msxml3.dll (0x80070005) Access is denied error on the xmlhttp.Send line which is baffling me.

set xmlhttp = Server.CreateObject("Msxml2.XMLHTTP")
            xmlhttp.Open "POST", "http://www.kapow.co.uk/scripts/sendsms.php", false
            xmlhttp.setRequestHeader "lastCached", now()
            xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
            xmlhttp.Send ("username=xxxx&password=xxx&mobile=" & mobileNum & "&sms=" & txtMsg & "&from_id=" & msgLabel & "&url=http://www.xxxx.co.uk/kapow/callback.asp")
            set xmlhttp = nothing
            status = "SMS sent - awaiting status report"
            smsSendInc = null
            checkStatus = false

Any help will be greatly appreciated.

Cheers
0
digital_soul
Asked:
digital_soul
1 Solution
 
esw074Commented:
Sounds like a permissions error.  Be sure that the "internet user account" (iusr) has permission to access the msxml3 DLL.
0
 
digital_soulAuthor Commented:
If that was the case then why would the data be sent anyway?
0
 
amit_gCommented:
You are doing it from the asp right? If so use MSXML2.ServerXMLHTTP instead of Msxml2.XMLHTTP

set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
digital_soulAuthor Commented:
Nope. Same problem with MSXML2.ServerXMLHTTP. The data is sent to the extrnal url, but still getting an error on the  xmlhttp.Send line.

How is it that that line is able to process (the data gets picked up at the other URL) and generate a permissions error as well? Is it throwing an exception to a response back from the POST send that I need to deal with??

Cheers
0
 
amit_gCommented:
Since you have posted the URL that you are using, I could do my own testing and here is what is happening. The site where you post data gets the data successfully as you have already know. Your posted data has a parameter called URL. Using that the kapow.co.uk sends a 320 redirect header back. MSXML has a problem with that due the fact that the original domain and the redirected domain are different. You have 2 options. One - don't set the URL but then you won't get a callback and so you won't know but this would work, if you don't really care about calling callback.asp. Two - use WinHttp.WinHttpRequest.5.1 object instead of XMLHttp. Just change the progid from Msxml2.XMLHTTP to WinHttp.WinHttpRequest.5.1. Everything else remains same. Also there is another problem. kapow.co.uk is adding http:// to the URL so your request should not include it. So change

xmlhttp.Send ("username=xxxx&password=xxx&mobile=" & mobileNum & "&sms=" & txtMsg & "&from_id=" & msgLabel & "&url=http://www.xxxx.co.uk/kapow/callback.asp")

to

xmlhttp.Send ("username=xxxx&password=xxx&mobile=" & mobileNum & "&sms=" & txtMsg & "&from_id=" & msgLabel & "&url=www.xxxx.co.uk/kapow/callback.asp")
0
 
Computer101Commented:
PAQed with no points refunded (of 125)

Computer101
EE Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now