Using XMLHTTP to post form data
am 13.01.2007 01:41:50 von Pupkin
Hi,
I've got a web form that needs to submit its data in a number of
different directions.
I was hoping to use XMLHTTP to post it to two external service providers
EROI and Salesforce)
So far I've just been working on the EROI part, and while I don't get
any errors, it doesn't appear to be working, as no new data is showing
up in EROI.
Where xmlhttperoi is the variable storing my long string of fields and
values, this is my code:
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open
"POST","http://emailer.emailroi.com/multisubscribe.ice",fals e
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
xmlhttp.send xmlhttperoi
Response.ContentType = "text"
Response.Write xmlhttp.responsexml.xml
Set xmlhttp = nothing
Anyone notice any obvious flaws in there? (Server is w2003, IIS6)
When I had "Response.ContentType = "text"" set to "text/xml" it would
return an xml syntax error on the "@" of an email address in the post
string. Could that be the culprit? I don't think EROI is receiving this
as XML, so I'd doubt it, but I'm sort of dumb most of the time.
Thanks.
Re: Using XMLHTTP to post form data
am 13.01.2007 17:04:40 von Anthony Jones
"Pupkin" wrote in message
news:MPG.2011caa495edc557989796@news.giganews.com...
> Hi,
>
> I've got a web form that needs to submit its data in a number of
> different directions.
>
> I was hoping to use XMLHTTP to post it to two external service providers
> EROI and Salesforce)
>
> So far I've just been working on the EROI part, and while I don't get
> any errors, it doesn't appear to be working, as no new data is showing
> up in EROI.
>
> Where xmlhttperoi is the variable storing my long string of fields and
> values, this is my code:
>
> set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
> xmlhttp.Open
> "POST","http://emailer.emailroi.com/multisubscribe.ice",fals e
> xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
> urlencoded"
> xmlhttp.send xmlhttperoi
> Response.ContentType = "text"
> Response.Write xmlhttp.responsexml.xml
> Set xmlhttp = nothing
>
>
> Anyone notice any obvious flaws in there? (Server is w2003, IIS6)
What type of object is xmlhttperoi??
What type of content are these 'services' expecting, XML or HTML Form posts?
If XML the you've set the Content-Type header incorrectly.
If HTML Form Post the xmlhttperoi needs to be a URL encoded string.
>
> When I had "Response.ContentType = "text"" set to "text/xml" it would
> return an xml syntax error on the "@" of an email address in the post
> string. Could that be the culprit? I don't think EROI is receiving this
> as XML, so I'd doubt it, but I'm sort of dumb most of the time.
>
>
> Thanks.