XMLHTTP not working

X

xarrisx

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
 
B

Bob Barrows [MVP]

xarrisx said:
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.
 
X

xarrisx

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 said:
xarrisx said:
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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top