charlion Posted June 28, 2017 Share Posted June 28, 2017 <?php $url = "https://btc-e.com/api/3/ticker/btc_usd"; $fileGet = file_get_contents($url); $json = json_decode($fileGet, TRUE); $json = $json["ticker"]["last"]; $premium = 5; //in percentage $premium = $premium / 100; $dollar_amount = $premium * $json; $customer_price = $json + $dollar_amount; echo $customer_price; ?> i was trying to display my own premiunm exchange rate. i mean (Buy Bitcoin on my site at $.....). i was doing this by using the last exchange rate from btc-e.com/api/btc_usd.which was a jason. what i did is that i define my own percentage from there last exchange rate and i add that percentage to it.but it doesn't work. above is example of my code let say im working with addition of 5 percent. please can i get a help ? Quote Link to comment https://forums.phpfreaks.com/topic/304218-bitcoin-premium-exchange-rate/ Share on other sites More sharing options...
requinix Posted June 28, 2017 Share Posted June 28, 2017 I don't see a ["ticker"] anywhere in that JSON. Quote Link to comment https://forums.phpfreaks.com/topic/304218-bitcoin-premium-exchange-rate/#findComment-1547800 Share on other sites More sharing options...
wallace45 Posted July 5, 2017 Share Posted July 5, 2017 Have you ever make it work? Quote Link to comment https://forums.phpfreaks.com/topic/304218-bitcoin-premium-exchange-rate/#findComment-1548008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.