Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Realtime gold price on website (http://www.velocityreviews.com/forums/t798965-realtime-gold-price-on-website.html)

06-17-2005 03:41 AM

Realtime gold price on website
 
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



Curt_C [MVP] 06-17-2005 12:45 PM

Re: Realtime gold price on website
 
TRB_NV@hotmail.com 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

06-18-2005 06:36 AM

Re: Realtime gold price on website
 
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:OgaJ8pzcFHA.2880@TK2MSFTNGP09.phx.gbl...
> TRB_NV@hotmail.com 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




larrybud2002@yahoo.com 06-20-2005 06:11 PM

Re: Realtime gold price on website
 


TRB_NV@hotmail.com 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


larrybud2002@yahoo.com 06-20-2005 06:13 PM

Re: Realtime gold price on website
 


TRB_NV@hotmail.com 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


Tim Slattery 06-20-2005 08:06 PM

Re: Realtime gold price on website
 
larrybud2002@yahoo.com wrote:

>
>
>TRB_NV@hotmail.com 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)
Slattery_T@bls.gov

06-21-2005 08:59 PM

Re: Realtime gold price on website
 
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" <Slattery_T@bls.gov> wrote in message
news:a88eb1t6rm5ede9hed4vg10k7heqibmv0j@4ax.com...
> larrybud2002@yahoo.com wrote:
>
> >
> >
> >TRB_NV@hotmail.com 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)
> Slattery_T@bls.gov




McKirahan 06-22-2005 12:55 AM

Re: Realtime gold price on website
 
<TRB_NV@hotmail.com> wrote in message
news:uCDevQqdFHA.2288@TK2MSFTNGP14.phx.gbl...
> 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" <Slattery_T@bls.gov> wrote in message
> news:a88eb1t6rm5ede9hed4vg10k7heqibmv0j@4ax.com...
> > larrybud2002@yahoo.com wrote:
> >
> > >
> > >
> > >TRB_NV@hotmail.com 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)
> > Slattery_T@bls.gov

>
>


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.



06-22-2005 07:55 AM

Re: Realtime gold price on website
 
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" <News@McKirahan.com> wrote in message
news:i7-dnTJ9-_ERKyXfRVn-rg@comcast.com...
> <TRB_NV@hotmail.com> wrote in message
> news:uCDevQqdFHA.2288@TK2MSFTNGP14.phx.gbl...
> > 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" <Slattery_T@bls.gov> wrote in message
> > news:a88eb1t6rm5ede9hed4vg10k7heqibmv0j@4ax.com...
> > > larrybud2002@yahoo.com wrote:
> > >
> > > >
> > > >
> > > >TRB_NV@hotmail.com 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)
> > > Slattery_T@bls.gov

> >
> >

>
> 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 06-22-2005 09:50 AM

Re: Realtime gold price on website
 
<TRB_NV@hotmail.com> wrote in message
news:#c4DE$vdFHA.1504@TK2MSFTNGP15.phx.gbl...
> 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.)




All times are GMT. The time now is 01:08 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.