Bitcoin Forum

Economy => Services => Topic started by: idev on July 12, 2013, 01:34:19 AM



Title: Display BTC/LTC ASK/BID pricing on a website
Post by: idev on July 12, 2013, 01:34:19 AM
Does anyone have some simple PHP code to display ask and bid prices for both btc and ltc on a website ?


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: idev on July 12, 2013, 12:14:13 PM
I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP.


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: /dev/null on July 12, 2013, 12:30:45 PM
by ask/bid you mean buy/sell prices?



Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: DarkHyudrA on July 12, 2013, 07:56:46 PM
What site
This


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: idev on July 12, 2013, 10:16:06 PM
What site and how much are you offering?

Quote
I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: idev on July 13, 2013, 11:29:48 AM
What site and how much are you offering?

Quote
I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP

Mmmkay, still didn't tell us the site.

Site is unimportant as it's still being built so there is nothing to see.
I just need the code so i can continue with building the site. 


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: idev on July 13, 2013, 02:49:26 PM
What site and how much are you offering?

Quote
I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP

Mmmkay, still didn't tell us the site.

Site is unimportant as it's still being built so there is nothing to see.
I just need the code so i can continue with building the site. 

So, you need code to interface with a site that you won't give us, so we have no idea what we're coding? I wish you luck.

I sent you a pm.


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: rme on July 13, 2013, 02:55:01 PM
Mtgox: BTC to USD
Code:
<?php
function curl_download($url){
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_REFERER"");
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31");
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_TIMEOUT3); // Timeout in seconds
    
$output curl_exec($ch);
    
curl_close($ch);
    return 
$output;
}

$ticker_json curl_download("http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast?pretty");
$ticker json_decode($ticker_jsontrue);

//Last exchange rate
echo $ticker['data']['last']['value'];
echo 
'<br>';

//Buy rate
echo $ticker['data']['buy']['value'];
echo 
'<br>';

//Sell rate
echo $ticker['data']['sell']['value'];
echo 
'<br>';

MtGox: BTC to EUR
Code:
<?php
function curl_download($url){
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_REFERER"");
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31");
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_TIMEOUT3); // Timeout in seconds
    
$output curl_exec($ch);
    
curl_close($ch);
    return 
$output;
}

$ticker_json curl_download("http://data.mtgox.com/api/2/BTCEUR/money/ticker_fast?pretty");
$ticker json_decode($ticker_jsontrue);

//Last exchange rate
echo $ticker['data']['last']['value'];
echo 
'<br>';

//Buy rate
echo $ticker['data']['buy']['value'];
echo 
'<br>';

//Sell rate
echo $ticker['data']['sell']['value'];
echo 
'<br>';


BTC-E: LTC to BTC
Code:
<?php
function curl_download($url){
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_REFERER"");
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31");
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_TIMEOUT6); // Timeout in seconds
    
$output curl_exec($ch);
    
curl_close($ch);
    return 
$output;
}

$ticker_json curl_download("https://btc-e.com/api/2/ltc_btc/ticker");
$ticker json_decode($ticker_jsontrue);

//Last exchange rate
echo $ticker['last'];
echo 
'<br>';

//Buy rate
echo $ticker['buy'];
echo 
'<br>';

//Sell rate
echo $ticker['sell'];
echo 
'<br>';


BTC-E: LTC to USD
Code:
<?php
function curl_download($url){
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_REFERER"");
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31");
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_TIMEOUT6); // Timeout in seconds
    
$output curl_exec($ch);
    
curl_close($ch);
    return 
$output;
}

$ticker_json curl_download("https://btc-e.com/api/2/ltc_usd/ticker");
$ticker json_decode($ticker_jsontrue);

//Last exchange rate
echo $ticker['last'];
echo 
'<br>';

//Buy rate
echo $ticker['buy'];
echo 
'<br>';

//Sell rate
echo $ticker['sell'];
echo 
'<br>';


btc: 1R2sWeVhFitB8zVbkrmdSoXzaQRsw6cfh
ltc:  LRMELyS5NPhg6tE7dhQ4wueptfa4jDd7zq


Title: Re: Display BTC/LTC ASK/BID pricing on a website
Post by: escrow.ms on July 16, 2013, 10:59:13 PM
I assume OP got what he wants but just for ref purpose i would like to post this.

You can use ticker images also.

http://cryptank.com/ticker/
Ex image: BTC USD MTGOX
http://ticker.cryptank.com/spread.png?exchange=mtgox&market=BTC_USD&bgc=efefff&fgc=000000&font=4%22%3E

Code
Code:
http://ticker.cryptank.com/spread.png?exchange=mtgox&market=BTC_USD&bgc=efefff&fgc=000000&font=4%22%3E

BTC USD Btc-e
http://ticker.cryptank.com/spread.png?exchange=btc-e&market=BTC_USD&bgc=efefff&fgc=000000&font=4%22%3E

code:
Code:
http://ticker.cryptank.com/spread.png?exchange=btc-e&market=BTC_USD&bgc=efefff&fgc=000000&font=4%22%3E

LTC USD Btc-e
http://ticker.cryptank.com/spread.png?exchange=btc-e&market=LTC_USD&bgc=efefff&fgc=000000&font=4%22%3E

code:
Code:
http://ticker.cryptank.com/spread.png?exchange=btc-e&market=LTC_USD&bgc=efefff&fgc=000000&font=4%22%3E
You just need to change market and currency codes.