XMLHTTP not working

Discussion in 'ASP General' started by xarrisx, Dec 15, 2004.

  1. xarrisx

    xarrisx Guest

    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
    xarrisx, Dec 15, 2004
    #1
    1. Advertising

  2. 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"
    Bob Barrows [MVP], Dec 15, 2004
    #2
    1. Advertising

  3. xarrisx

    xarrisx Guest

    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]" <> wrote in message
    news:...
    > 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"
    >
    >
    xarrisx, Dec 15, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cGV0ZXJsYW4=?=
    Replies:
    1
    Views:
    412
    bruce barker \(sqlwork.com\)
    May 8, 2006
  2. Replies:
    1
    Views:
    121
    Anthony Jones
    Mar 10, 2006
  3. warteschlange

    loading js code with xmlhttp working (but..)

    warteschlange, Jul 17, 2005, in forum: Javascript
    Replies:
    4
    Views:
    101
    Randy Webb
    Jul 22, 2005
  4. Replies:
    2
    Views:
    73
  5. yawnmoth

    Msxml*.XMLHTTP vs. Microsoft.XMLHTTP

    yawnmoth, Nov 7, 2006, in forum: Javascript
    Replies:
    11
    Views:
    374
    Matt Kruse
    Nov 9, 2006
Loading...

Share This Page