Bitcoin Forum
November 10, 2024, 08:07:11 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Display BTC/LTC ASK/BID pricing on a website  (Read 1366 times)
idev (OP)
Hero Member
*****
Offline Offline

Activity: 860
Merit: 1004


BTC OG and designer of the BitcoinMarket.com logo


View Profile
July 12, 2013, 01:34:19 AM
 #1

Does anyone have some simple PHP code to display ask and bid prices for both btc and ltc on a website ?
idev (OP)
Hero Member
*****
Offline Offline

Activity: 860
Merit: 1004


BTC OG and designer of the BitcoinMarket.com logo


View Profile
July 12, 2013, 12:14:13 PM
Last edit: July 12, 2013, 10:14:59 PM by idev
 #2

I'm willing to pay 1-2 LTC for this. Should be pretty quick for someone who knows PHP.
/dev/null
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
July 12, 2013, 12:30:45 PM
Last edit: July 12, 2013, 01:41:40 PM by /dev/null
 #3

by ask/bid you mean buy/sell prices?


DarkHyudrA
Legendary
*
Offline Offline

Activity: 1386
Merit: 1000


English <-> Portuguese translations


View Profile
July 12, 2013, 07:56:46 PM
 #4

What site
This

English <-> Brazilian Portuguese translations
idev (OP)
Hero Member
*****
Offline Offline

Activity: 860
Merit: 1004


BTC OG and designer of the BitcoinMarket.com logo


View Profile
July 12, 2013, 10:16:06 PM
 #5

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
idev (OP)
Hero Member
*****
Offline Offline

Activity: 860
Merit: 1004


BTC OG and designer of the BitcoinMarket.com logo


View Profile
July 13, 2013, 11:29:48 AM
 #6

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. 
idev (OP)
Hero Member
*****
Offline Offline

Activity: 860
Merit: 1004


BTC OG and designer of the BitcoinMarket.com logo


View Profile
July 13, 2013, 02:49:26 PM
 #7

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.
rme
Hero Member
*****
Offline Offline

Activity: 756
Merit: 504



View Profile
July 13, 2013, 02:55:01 PM
Last edit: July 13, 2013, 03:07:34 PM by rme
 #8

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
escrow.ms
Legendary
*
Offline Offline

Activity: 1274
Merit: 1004


View Profile
July 16, 2013, 10:59:13 PM
 #9

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.
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!