Author

Topic: Display BTC/LTC ASK/BID pricing on a website (Read 1375 times)

legendary
Activity: 1274
Merit: 1004
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


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


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


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.
rme
hero member
Activity: 756
Merit: 504
Mtgox: BTC to USD
Code:
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 
'
'
;

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

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

MtGox: BTC to EUR
Code:
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 
'
'
;

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

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


BTC-E: LTC to BTC
Code:
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 
'
'
;

//Buy rate
echo $ticker['buy'];
echo 
'
'
;

//Sell rate
echo $ticker['sell'];
echo 
'
'
;


BTC-E: LTC to USD
Code:
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 
'
'
;

//Buy rate
echo $ticker['buy'];
echo 
'
'
;

//Sell rate
echo $ticker['sell'];
echo 
'
'
;


btc: 1R2sWeVhFitB8zVbkrmdSoXzaQRsw6cfh
ltc:  LRMELyS5NPhg6tE7dhQ4wueptfa4jDd7zq
hero member
Activity: 860
Merit: 1004
BTC OG and designer of the BitcoinMarket.com logo
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.
hero member
Activity: 860
Merit: 1004
BTC OG and designer of the BitcoinMarket.com logo
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. 
hero member
Activity: 860
Merit: 1004
BTC OG and designer of the BitcoinMarket.com logo
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
legendary
Activity: 1386
Merit: 1000
English <-> Portuguese translations
sr. member
Activity: 308
Merit: 250
by ask/bid you mean buy/sell prices?

hero member
Activity: 860
Merit: 1004
BTC OG and designer of the BitcoinMarket.com logo
I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP.
hero member
Activity: 860
Merit: 1004
BTC OG and designer of the BitcoinMarket.com logo
Does anyone have some simple PHP code to display ask and bid prices for both btc and ltc on a website ?
Jump to: