Bitcoin Forum
June 28, 2024, 08:10:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [CLOSED] BOUNTY: 10 BTC for a simple script  (Read 1200 times)
Trader Steve (OP)
Hero Member
*****
Offline Offline

Activity: 836
Merit: 1007


"How do you eat an elephant? One bit at a time..."


View Profile
December 23, 2011, 12:57:10 PM
Last edit: December 23, 2011, 08:01:03 PM by Trader Steve
 #1

Greetings Coders,

I am looking for a simple script that will do the following:

Display the price of 1 gram of silver in U.S. dollars

Additional info:

The spot price of silver is usually quoted in troy ounces on sites like www.kitco.com. Here is the conversion formula:

1 troy ounce = 31.1034768 grams

Please PM me if you are interested.

Thanks,
Trader Steve
Raoul Duke
aka psy
Legendary
*
Offline Offline

Activity: 1358
Merit: 1002



View Profile
December 23, 2011, 01:17:20 PM
 #2

php?
sadpandatech
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500



View Profile
December 23, 2011, 07:14:56 PM
 #3

Do you have your own feed source for the data?

If you're not excited by the idea of being an early adopter 'now', then you should come back in three or four years and either tell us "Told you it'd never work!" or join what should, by then, be a much more stable and easier-to-use system.
- GA

It is being worked on by smart people.  -DamienBlack
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
December 23, 2011, 07:25:04 PM
 #4

more info please:

what scripting language?
which site to get the info from?

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
mcorlett
Donator
Sr. Member
*
Offline Offline

Activity: 308
Merit: 250



View Profile
December 23, 2011, 07:38:13 PM
Last edit: December 23, 2011, 08:37:17 PM by mcorlett
 #5

Code:
<?php
$decimals 
2;

$ticker json_decode(file_get_contents('http://drayah.no.de/metals/latest'), TRUE);
$silver $ticker['silver']['quote'];

echo 
round($silver/31.1034768$decimals);
?>

drayah's node.js box parses the prices from kitco.com.

Update: Here's a version that fallbacks to http://services.packetizer.com/spotprices/ if drayah's service is down (I'm keeping the old one for posterity):
Code:
<?php
$decimals 
2;

$drayah json_decode(file_get_contents('http://drayah.no.de/metals/latest'), TRUE);
if (
$drayah['silver']['quote'] > 0) {
$silver $drayah['silver']['quote'];
} else {
$packetizer = new SimpleXMLElement(file_get_contents('http://services.packetizer.com/spotprices/?f=xml'));
$silver $packetizer->silver;
}

echo 
round($silver/31.1034768$decimals);
?>
Update 2: Made another change should drayah's service be up but kitco down.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!