Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > XMLHTTP not working

Reply
Thread Tools

XMLHTTP not working

 
 
xarrisx
Guest
Posts: n/a
 
      12-15-2004
Have a look at this address
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml

in my asp code i am using

<%
Set xml = CreateObject("Msxml2.XMLHTTP.3.0")
xml.Open "GET", "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml",
False
xml.Send
%>

<%=xml.responseXML.xml%>

----------------------------------------
result

"Reference rates European Central Bank "
---------------------------------------------

How can i get the value for each currency?

I can't make it work for the last 2 days . Any idea about what is wrong?

Thank (a lot) in advance
for any info


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-15-2004
xarrisx wrote:
> Have a look at this address
> http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
>
> in my asp code i am using
>
> <%
> Set xml = CreateObject("Msxml2.XMLHTTP.3.0")
> xml.Open "GET",
> "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml", False
> xml.Send
> %>
>
> <%=xml.responseXML.xml%>
>
> ----------------------------------------
> result
>
> "Reference rates European Central Bank "
> ---------------------------------------------
>
> How can i get the value for each currency?
>
> I can't make it work for the last 2 days . Any idea about what is
> wrong?
>
> Thank (a lot) in advance
> for any info


View the page source instead of relying on the output in the browser window.

It works fine for me. You might also wish to try using:
response.contenttype="text/xml"
if you want to display the xml in the browser.

If you really want to get the rates, you should use selectNodes, like this:

<%
dim xml,xmldoc, oNodes, oNode
set xmldoc=createobject("msxml2.domdocument.3.0")
Set xml = CreateObject("Msxml2.ServerXMLHTTP.3.0")
xml.Open "GET",
"http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml",False
xml.Send

set xmldoc=xml.responsexml
set oNodes=xmldoc.selectNodes("//Cube[@currency]")
for each oNode in oNodes
Response.Write onode.getattribute("currency") & ": " & _
onode.getattribute("rate") & "<BR>"
next

%>

Bob Barrows

PS. In server-side code, you should be using ServerXMLHTTP, not XMLHTTP. Go
to msdn.microsoft.com/library and read up on it.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
xarrisx
Guest
Posts: n/a
 
      12-15-2004
Thanks bob i was an idiot for not checking at the source code.
Also thank for the code in getting each value!!1


"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> xarrisx wrote:
> > Have a look at this address
> > http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
> >
> > in my asp code i am using
> >
> > <%
> > Set xml = CreateObject("Msxml2.XMLHTTP.3.0")
> > xml.Open "GET",
> > "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml", False
> > xml.Send
> > %>
> >
> > <%=xml.responseXML.xml%>
> >
> > ----------------------------------------
> > result
> >
> > "Reference rates European Central Bank "
> > ---------------------------------------------
> >
> > How can i get the value for each currency?
> >
> > I can't make it work for the last 2 days . Any idea about what is
> > wrong?
> >
> > Thank (a lot) in advance
> > for any info

>
> View the page source instead of relying on the output in the browser

window.
>
> It works fine for me. You might also wish to try using:
> response.contenttype="text/xml"
> if you want to display the xml in the browser.
>
> If you really want to get the rates, you should use selectNodes, like

this:
>
> <%
> dim xml,xmldoc, oNodes, oNode
> set xmldoc=createobject("msxml2.domdocument.3.0")
> Set xml = CreateObject("Msxml2.ServerXMLHTTP.3.0")
> xml.Open "GET",
> "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml",False
> xml.Send
>
> set xmldoc=xml.responsexml
> set oNodes=xmldoc.selectNodes("//Cube[@currency]")
> for each oNode in oNodes
> Response.Write onode.getattribute("currency") & ": " & _
> onode.getattribute("rate") & "<BR>"
> next
>
> %>
>
> Bob Barrows
>
> PS. In server-side code, you should be using ServerXMLHTTP, not XMLHTTP.

Go
> to msdn.microsoft.com/library and read up on it.
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Msxml*.XMLHTTP vs. Microsoft.XMLHTTP yawnmoth Javascript 11 11-09-2006 08:44 PM
xmlhttp requests not returning until long-running process is compl =?Utf-8?B?cGV0ZXJsYW4=?= ASP .Net 1 05-08-2006 04:13 PM
xmlHTTP not getting the response as4532@drexel.edu ASP General 1 03-10-2006 08:40 AM
onresize it not working with XMLHTTP FrankIsHere@gmail.com Javascript 2 01-08-2006 04:32 AM
loading js code with xmlhttp working (but..) warteschlange Javascript 4 07-22-2005 09:14 PM



Advertisments