Realtime gold price on website

Discussion in 'ASP General' started by Guest, Jun 17, 2005.

  1. Guest

    Guest Guest

    Does anyone know an easy way to put a current gold price on your own
    website? I've seen the graphic methods that Kitco.com offers, but I'd
    rather have it pull the value from some gold market system in text format.

    I found a website that's doing it, but don't know where to start in reverse
    engineering the code:
    http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp

    Thanks
    Guest, Jun 17, 2005
    #1
    1. Advertising

  2. Guest

    Curt_C [MVP] Guest

    wrote:
    > Does anyone know an easy way to put a current gold price on your own
    > website? I've seen the graphic methods that Kitco.com offers, but I'd
    > rather have it pull the value from some gold market system in text format.
    >
    > I found a website that's doing it, but don't know where to start in reverse
    > engineering the code:
    > http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    >
    > Thanks
    >
    >

    you try a VIEW SOURCE to see what's rendered? There may be a clue in it.

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com
    Curt_C [MVP], Jun 17, 2005
    #2
    1. Advertising

  3. Guest

    Guest Guest

    I'd already picked through the source, but I can't find anything that looks
    like it's doing a query.

    "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
    news:...
    > wrote:
    > > Does anyone know an easy way to put a current gold price on your own
    > > website? I've seen the graphic methods that Kitco.com offers, but I'd
    > > rather have it pull the value from some gold market system in text

    format.
    > >
    > > I found a website that's doing it, but don't know where to start in

    reverse
    > > engineering the code:
    > > http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    > >
    > > Thanks
    > >
    > >

    > you try a VIEW SOURCE to see what's rendered? There may be a clue in it.
    >
    > --
    > Curt Christianson
    > site: http://www.darkfalz.com
    > blog: http://blog.darkfalz.com
    Guest, Jun 18, 2005
    #3
  4. Guest

    Guest

    wrote:
    > Does anyone know an easy way to put a current gold price on your own
    > website? I've seen the graphic methods that Kitco.com offers, but I'd
    > rather have it pull the value from some gold market system in text format.
    >
    > I found a website that's doing it, but don't know where to start in reverse
    > engineering the code:
    > http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp



    Here you go. Free Gold price in XML feed.

    http://dgcsc.org/goldprices.htm
    , Jun 20, 2005
    #4
  5. Guest

    Guest

    wrote:
    > Does anyone know an easy way to put a current gold price on your own
    > website? I've seen the graphic methods that Kitco.com offers, but I'd
    > rather have it pull the value from some gold market system in text format.
    >
    > I found a website that's doing it, but don't know where to start in reverse
    > engineering the code:
    > http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    >
    > Thanks


    Oh, prices are in grams.

    1 ounce = 28.3495231 grams
    , Jun 20, 2005
    #5
  6. Guest

    Tim Slattery Guest

    wrote:

    >
    >
    > wrote:
    >> Does anyone know an easy way to put a current gold price on your own
    >> website? I've seen the graphic methods that Kitco.com offers, but I'd
    >> rather have it pull the value from some gold market system in text format.
    >>
    >> I found a website that's doing it, but don't know where to start in reverse
    >> engineering the code:
    >> http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    >>
    >> Thanks

    >
    >Oh, prices are in grams.
    >
    >1 ounce = 28.3495231 grams


    I believe that's one avoirdupois ounce. But precious metals are sold
    in Troy ounces.....

    According to http://en.wikipedia.org/wiki/Troy_weight, one Troy ounce
    is 31.103477 gram.

    --
    Tim Slattery
    MS MVP(DTS)
    Tim Slattery, Jun 20, 2005
    #6
  7. Guest

    Guest Guest

    I can't quite figure out this last part. How do I pull the value for:
    <Price currencyname="United States Dollar"
    currencycode="USD">14.0788</Price>
    from http://dgcsc.org/goldprices.xml and use it in my ASP code for the
    variable GoldPrice_Gram? Thanks.

    <%@ LANGUAGE="VBSCRIPT" %>
    <%
    GoldPrice_Gram = 14.0788
    GramsPerTroyOunce = 31.103477
    GoldPrice_Ounce = GoldPrice_Gram * GramsPerTroyOunce

    response.write "Gold Price: " & round(GoldPrice_Ounce,4)
    %>



    "Tim Slattery" <> wrote in message
    news:...
    > wrote:
    >
    > >
    > >
    > > wrote:
    > >> Does anyone know an easy way to put a current gold price on your own
    > >> website? I've seen the graphic methods that Kitco.com offers, but I'd
    > >> rather have it pull the value from some gold market system in text

    format.
    > >>
    > >> I found a website that's doing it, but don't know where to start in

    reverse
    > >> engineering the code:
    > >> http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    > >>
    > >> Thanks

    > >
    > >Oh, prices are in grams.
    > >
    > >1 ounce = 28.3495231 grams

    >
    > I believe that's one avoirdupois ounce. But precious metals are sold
    > in Troy ounces.....
    >
    > According to http://en.wikipedia.org/wiki/Troy_weight, one Troy ounce
    > is 31.103477 gram.
    >
    > --
    > Tim Slattery
    > MS MVP(DTS)
    >
    Guest, Jun 21, 2005
    #7
  8. Guest

    McKirahan Guest

    <> wrote in message
    news:...
    > I can't quite figure out this last part. How do I pull the value for:
    > <Price currencyname="United States Dollar"
    > currencycode="USD">14.0788</Price>
    > from http://dgcsc.org/goldprices.xml and use it in my ASP code for the
    > variable GoldPrice_Gram? Thanks.
    >
    > <%@ LANGUAGE="VBSCRIPT" %>
    > <%
    > GoldPrice_Gram = 14.0788
    > GramsPerTroyOunce = 31.103477
    > GoldPrice_Ounce = GoldPrice_Gram * GramsPerTroyOunce
    >
    > response.write "Gold Price: " & round(GoldPrice_Ounce,4)
    > %>
    >
    >
    >
    > "Tim Slattery" <> wrote in message
    > news:...
    > > wrote:
    > >
    > > >
    > > >
    > > > wrote:
    > > >> Does anyone know an easy way to put a current gold price on your own
    > > >> website? I've seen the graphic methods that Kitco.com offers, but

    I'd
    > > >> rather have it pull the value from some gold market system in text

    > format.
    > > >>
    > > >> I found a website that's doing it, but don't know where to start in

    > reverse
    > > >> engineering the code:
    > > >> http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    > > >>
    > > >> Thanks
    > > >
    > > >Oh, prices are in grams.
    > > >
    > > >1 ounce = 28.3495231 grams

    > >
    > > I believe that's one avoirdupois ounce. But precious metals are sold
    > > in Troy ounces.....
    > >
    > > According to http://en.wikipedia.org/wiki/Troy_weight, one Troy ounce
    > > is 31.103477 gram.
    > >
    > > --
    > > Tim Slattery
    > > MS MVP(DTS)
    > >

    >
    >


    Will this help? Watch for word-wrap.

    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit
    '*
    Const cOZT = 31.103477
    Const cURL = "http://dgcsc.org/goldprices.xml"
    '*
    Dim iPRC
    iPRC = 0.0000
    '*
    Dim oXML
    Set oXML = CreateObject("Microsoft.XMLDOM")
    oXML.async = "false"
    oXML.load(cURL)
    iPRC = oXML.getElementsByTagName("Price").item(21).text
    Set oXML = Nothing
    '*
    Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    %>

    This assumes that "USD" is always at the same offset in the XML file.
    McKirahan, Jun 22, 2005
    #8
  9. Guest

    Guest Guest

    Almost there, but it won't read the XML data if I try HTTP:
    oXML.load("http://dgcsc.org/goldprices.xml")
    '* Doesn't work. I hardcoded the URL just to make sure it was calling the
    correct location.

    oXML.load(Server.MapPath("goldprices.xml"))
    '* Works perfectly. For testing purposes I copied the goldprices.xml file
    from dgcsc.org into the same directly on the server as the ASP file.

    Anyone got any ideas how to get this last bit to work?
    Here's the complete code:

    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit
    '*
    Const cOZT = 31.103477
    Const cURL = "http://dgcsc.org/goldprices.xml"
    '*
    Dim iPRC
    iPRC = 0.0000
    '*
    Dim oXML
    Set oXML = CreateObject("Microsoft.XMLDOM")
    oXML.async = "false"
    '* oXML.load(cURL)
    oXML.load(Server.MapPath("goldprices.xml"))
    iPRC = oXML.getElementsByTagName("Price").item(21).text
    Set oXML = Nothing
    '*
    Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    %>

    "McKirahan" <> wrote in message
    news:...
    > <> wrote in message
    > news:...
    > > I can't quite figure out this last part. How do I pull the value for:
    > > <Price currencyname="United States Dollar"
    > > currencycode="USD">14.0788</Price>
    > > from http://dgcsc.org/goldprices.xml and use it in my ASP code for the
    > > variable GoldPrice_Gram? Thanks.
    > >
    > > <%@ LANGUAGE="VBSCRIPT" %>
    > > <%
    > > GoldPrice_Gram = 14.0788
    > > GramsPerTroyOunce = 31.103477
    > > GoldPrice_Ounce = GoldPrice_Gram * GramsPerTroyOunce
    > >
    > > response.write "Gold Price: " & round(GoldPrice_Ounce,4)
    > > %>
    > >
    > >
    > >
    > > "Tim Slattery" <> wrote in message
    > > news:...
    > > > wrote:
    > > >
    > > > >
    > > > >
    > > > > wrote:
    > > > >> Does anyone know an easy way to put a current gold price on your

    own
    > > > >> website? I've seen the graphic methods that Kitco.com offers, but

    > I'd
    > > > >> rather have it pull the value from some gold market system in text

    > > format.
    > > > >>
    > > > >> I found a website that's doing it, but don't know where to start in

    > > reverse
    > > > >> engineering the code:
    > > > >> http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
    > > > >>
    > > > >> Thanks
    > > > >
    > > > >Oh, prices are in grams.
    > > > >
    > > > >1 ounce = 28.3495231 grams
    > > >
    > > > I believe that's one avoirdupois ounce. But precious metals are sold
    > > > in Troy ounces.....
    > > >
    > > > According to http://en.wikipedia.org/wiki/Troy_weight, one Troy ounce
    > > > is 31.103477 gram.
    > > >
    > > > --
    > > > Tim Slattery
    > > > MS MVP(DTS)
    > > >

    > >
    > >

    >
    > Will this help? Watch for word-wrap.
    >
    > <%@ LANGUAGE="VBSCRIPT" %>
    > <% Option Explicit
    > '*
    > Const cOZT = 31.103477
    > Const cURL = "http://dgcsc.org/goldprices.xml"
    > '*
    > Dim iPRC
    > iPRC = 0.0000
    > '*
    > Dim oXML
    > Set oXML = CreateObject("Microsoft.XMLDOM")
    > oXML.async = "false"
    > oXML.load(cURL)
    > iPRC = oXML.getElementsByTagName("Price").item(21).text
    > Set oXML = Nothing
    > '*
    > Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    > %>
    >
    > This assumes that "USD" is always at the same offset in the XML file.
    >
    >
    Guest, Jun 22, 2005
    #9
  10. Guest

    McKirahan Guest

    <> wrote in message
    news:#c4DE$...
    > Almost there, but it won't read the XML data if I try HTTP:
    > oXML.load("http://dgcsc.org/goldprices.xml")
    > '* Doesn't work. I hardcoded the URL just to make sure it was calling the
    > correct location.
    >
    > oXML.load(Server.MapPath("goldprices.xml"))
    > '* Works perfectly. For testing purposes I copied the goldprices.xml file
    > from dgcsc.org into the same directly on the server as the ASP file.
    >
    > Anyone got any ideas how to get this last bit to work?
    > Here's the complete code:
    >
    > <%@ LANGUAGE="VBSCRIPT" %>
    > <% Option Explicit
    > '*
    > Const cOZT = 31.103477
    > Const cURL = "http://dgcsc.org/goldprices.xml"
    > '*
    > Dim iPRC
    > iPRC = 0.0000
    > '*
    > Dim oXML
    > Set oXML = CreateObject("Microsoft.XMLDOM")
    > oXML.async = "false"
    > '* oXML.load(cURL)
    > oXML.load(Server.MapPath("goldprices.xml"))
    > iPRC = oXML.getElementsByTagName("Price").item(21).text
    > Set oXML = Nothing
    > '*
    > Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    > %>



    "oXML.load(cURL)" works for me.

    How do you know "it won't read"?

    Try adding this line after "oXML.load(cURL)"

    Response.Write "nodeName = " & oXML.documentElement.nodeName & "<br>"

    (Watch for word-wrap.)
    McKirahan, Jun 22, 2005
    #10
  11. Guest

    Guest Guest

    Adding Response.Write "nodeName = " & oXML.documentElement.nodeName & "<br>"
    after oXML.load(cURL) gives me an error:
    Object required: 'documentElement'

    It seems like I had to add an extra step to get it to work, which I don't
    like as your's is cleaner. Do you have any ideas as to why this was
    necessary or any further steps in trouble shooting?

    set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

    objHTTP.open "GET", cURL, false
    objHTTP.send
    set objXML = objHTTP.responseXML

    Complete code:
    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit
    '*
    Const cOZT = 31.103477
    Const cURL = "http://dgcsc.org/goldprices.xml"
    '*
    Dim iPRC, objHTTP, objXML, oXML
    iPRC = 0.0000
    '*

    set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

    objHTTP.open "GET", cURL, false
    objHTTP.send
    set objXML = objHTTP.responseXML

    set oXML=CreateObject("Microsoft.XMLDOM")
    oXML.async= "false"
    oXML.load(objXML)
    iPRC = oXML.getElementsByTagName("Price").item(21).text
    Set oXML = Nothing
    '*
    Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    %>

    "McKirahan" <> wrote in message
    news:...
    > <> wrote in message
    > news:#c4DE$...
    > > Almost there, but it won't read the XML data if I try HTTP:
    > > oXML.load("http://dgcsc.org/goldprices.xml")
    > > '* Doesn't work. I hardcoded the URL just to make sure it was calling

    the
    > > correct location.
    > >
    > > oXML.load(Server.MapPath("goldprices.xml"))
    > > '* Works perfectly. For testing purposes I copied the goldprices.xml

    file
    > > from dgcsc.org into the same directly on the server as the ASP file.
    > >
    > > Anyone got any ideas how to get this last bit to work?
    > > Here's the complete code:
    > >
    > > <%@ LANGUAGE="VBSCRIPT" %>
    > > <% Option Explicit
    > > '*
    > > Const cOZT = 31.103477
    > > Const cURL = "http://dgcsc.org/goldprices.xml"
    > > '*
    > > Dim iPRC
    > > iPRC = 0.0000
    > > '*
    > > Dim oXML
    > > Set oXML = CreateObject("Microsoft.XMLDOM")
    > > oXML.async = "false"
    > > '* oXML.load(cURL)
    > > oXML.load(Server.MapPath("goldprices.xml"))
    > > iPRC = oXML.getElementsByTagName("Price").item(21).text
    > > Set oXML = Nothing
    > > '*
    > > Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
    > > %>

    >
    >
    > "oXML.load(cURL)" works for me.
    >
    > How do you know "it won't read"?
    >
    > Try adding this line after "oXML.load(cURL)"
    >
    > Response.Write "nodeName = " & oXML.documentElement.nodeName & "<br>"
    >
    > (Watch for word-wrap.)
    >
    >
    Guest, Jun 22, 2005
    #11
  12. Guest

    McKirahan Guest

    <> wrote in message
    news:...
    > Adding Response.Write "nodeName = " & oXML.documentElement.nodeName &

    "<br>"
    > after oXML.load(cURL) gives me an error:
    > Object required: 'documentElement'
    >
    > It seems like I had to add an extra step to get it to work, which I don't
    > like as your's is cleaner. Do you have any ideas as to why this was
    > necessary or any further steps in trouble shooting?
    >
    > set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    >
    > objHTTP.open "GET", cURL, false
    > objHTTP.send
    > set objXML = objHTTP.responseXML


    [snip]

    What's your O/S (+ version) and browser (+ version)?

    For example, Win98SE and IE5.5 or WinXPPro and IE6.0.
    McKirahan, Jun 22, 2005
    #12
  13. Guest

    Guest Guest

    W2K Server SP4 & IE 6 (all updates)
    XPpro SP2 & IE 6 (all updates)

    "McKirahan" <> wrote in message
    news:...
    > <> wrote in message
    > news:...
    > > Adding Response.Write "nodeName = " & oXML.documentElement.nodeName &

    > "<br>"
    > > after oXML.load(cURL) gives me an error:
    > > Object required: 'documentElement'
    > >
    > > It seems like I had to add an extra step to get it to work, which I

    don't
    > > like as your's is cleaner. Do you have any ideas as to why this was
    > > necessary or any further steps in trouble shooting?
    > >
    > > set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    > >
    > > objHTTP.open "GET", cURL, false
    > > objHTTP.send
    > > set objXML = objHTTP.responseXML

    >
    > [snip]
    >
    > What's your O/S (+ version) and browser (+ version)?
    >
    > For example, Win98SE and IE5.5 or WinXPPro and IE6.0.
    >
    >
    Guest, Jun 22, 2005
    #13
  14. Guest

    GunsGoldGod

    Joined:
    Oct 22, 2012
    Messages:
    1
    Since the service for precious metal prices has disconntinued i found a new one: Precious Metals XML Price Feed ( http :// www .xmlcharts.com/precious-metals.html ) - Good luck!
    GunsGoldGod, Oct 22, 2012
    #14
    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. Danny Jensen
    Replies:
    0
    Views:
    878
    Danny Jensen
    Jun 28, 2004
  2. Guest

    (Gold Parser) Java tree

    Guest, Nov 15, 2004, in forum: Java
    Replies:
    0
    Views:
    1,332
    Guest
    Nov 15, 2004
  3. Nandhu
    Replies:
    0
    Views:
    421
    Nandhu
    Dec 4, 2007
  4. Jassim Rahma

    realtime oil price webservices?

    Jassim Rahma, Jul 14, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    429
  5. Martina
    Replies:
    2
    Views:
    130
    Anno Siegel
    Sep 10, 2005
Loading...

Share This Page