Author

Topic: Price Conversion Scripts for Websites. (Read 585 times)

newbie
Activity: 25
Merit: 0
April 09, 2013, 03:22:02 PM
#11
Okay, I found something pretty close to what I was after at http://btcticker.appspot.com/. Cheers!
newbie
Activity: 25
Merit: 0
April 09, 2013, 12:18:45 PM
#10
A ticker is great, but it's not quite what I was after. I was looking for something I could input a price into and it would come back with a price in BTC displayed on my website for the item I was selling based on the current exchange rate.

My site is a free website provider, so I'm not sure what it's programmed in, but it could be moved, or I have other servers that could do the heavy lifting in PHP or the like if queried.
full member
Activity: 182
Merit: 100
April 09, 2013, 02:05:24 AM
#9
PHP (mtgox_ticker.php)
Code:

echo json_encode(file_get_contents('https://data.mtgox.com/api/2/BTCUSD/money/ticker'));

?>


jQuery (ticker.js)
Code:
function getMtGoxTicker() {
 return jQuery.parseJSON($.ajax({
  dataType: "JSON",
  url: "mtgox_ticker.php",
  async: false
 }).responseText);
}


This should return a JavaScript object array with all the BTC price data your heart could want.

Data API: https://data.mtgox.com/api/2/BTCUSD/money/ticker

awesome thanks
member
Activity: 182
Merit: 10
April 09, 2013, 01:22:45 AM
#8
PHP (mtgox_ticker.php)
Code:

echo json_encode(file_get_contents('https://data.mtgox.com/api/2/BTCUSD/money/ticker'));

?>


jQuery (ticker.js)
Code:
function getMtGoxTicker() {
 return jQuery.parseJSON($.ajax({
  dataType: "JSON",
  url: "mtgox_ticker.php",
  async: false
 }).responseText);
}

This should return a JavaScript object array with all the BTC price data your heart could want.

Data API: https://data.mtgox.com/api/2/BTCUSD/money/ticker
member
Activity: 182
Merit: 10
April 09, 2013, 01:13:03 AM
#7
jquery is the standard, could you do this using mtgox 24hr avg?

jQuery will still require a PHP-proxy script, because of modern cross-site security implementations.

Give me a few minutes, and I'll post a php script to fetch the MtGox Avg. and a jQuery script to catch it.
full member
Activity: 182
Merit: 100
April 09, 2013, 01:03:53 AM
#6
jquery is the standard, could you do this using mtgox 24hr avg?
newbie
Activity: 28
Merit: 0
April 09, 2013, 01:01:31 AM
#5
What is your site primarily programmed in?
member
Activity: 182
Merit: 10
April 09, 2013, 12:58:07 AM
#4
Sure... Would you like it in PHP, JS, or jQuery?  I'll whip one up for you, it's not really that hard.
newbie
Activity: 25
Merit: 0
April 09, 2013, 12:50:38 AM
#3
Anything at all?
full member
Activity: 182
Merit: 100
April 07, 2013, 04:05:49 PM
#2
I'd like to know this as well, it could be very helpful for businesses.
newbie
Activity: 25
Merit: 0
April 07, 2013, 03:22:46 PM
#1
Hi, all!

I'm in the process of starting up a bitcoin-based business. Because what I'm offering (artwork) pretty much requires contact with the client in order to get the order and associated details correct, I'm not going to bother using a payment front-end such as Mt.Gox. The front-end they use, however, had a nice feature on it and that was to automatically convert the price from US$ to BTC based on the going exchange rate.

So my question is, does anyone with a head for scripting have or know of a script that I can put on my website, can set the US$ price and have it obtain and display the price in BTC at that moment, instead of requiring me to change my site daily (or more) to reflect the current price?

Thanks in advance!

CorvusCorax
Jump to: