Pages:
Author

Topic: [GUIDE] How to Make Bitcoin Price Converter in 2 Mins! [HTML/PHP] - page 2. (Read 4995 times)

hero member
Activity: 910
Merit: 1000
「きみはこれ&#
That is a very easy one.You can simply get in down with lot of other API's.Problem here is what is the refresh rate in seconds ? How often the page reloads to display the latest values ? I don't see any code for that.
legendary
Activity: 2044
Merit: 1030
I'm looking for free spin.
Very nice guide for me and it help to to put it in my site..
Also i want to use this for reference to make a converter for other altcoin.. i hope i can make mine with CBX price converter..
I am looking for other codes to increase my knowledge for making a new site which exchange site.. thanks again for this guide..
Your welcome mate, You can use any API to make one for any altcoin.
Simply change the URL of API and other is same.

I will PM you an example of CBX once im free.
Cheers.

EDIT:
CBX-USD:
Code:
$url "https://www.cryptonator.com/api/ticker/cbx-usd";
$data json_decode(file_get_contents($url), true);
$ticker $data['ticker'];
$latest_price $ticker['price'];
echo 
"$latest_price";
?>




CBX Price Converter





Wow great i will try it in free domain and hosting and i hope it will work..
And i hope i can see the sample once you are free,, thanks
full member
Activity: 210
Merit: 101
Very nice guide for me and it help to to put it in my site..
Also i want to use this for reference to make a converter for other altcoin.. i hope i can make mine with CBX price converter..
I am looking for other codes to increase my knowledge for making a new site which exchange site.. thanks again for this guide..
Your welcome mate, You can use any API to make one for any altcoin.
Simply change the URL of API and other is same.

I will PM you an example of CBX once im free.
Cheers.

EDIT:
CBX-USD:
Code:
$url "https://www.cryptonator.com/api/ticker/cbx-usd";
$data json_decode(file_get_contents($url), true);
$ticker $data['ticker'];
$latest_price $ticker['price'];
echo 
"$latest_price";
?>




CBX Price Converter





legendary
Activity: 2044
Merit: 1030
I'm looking for free spin.
Very nice guide for me and it help to to put it in my site..
Also i want to use this for reference to make a converter for other altcoin.. i hope i can make mine with CBX price converter..
I am looking for other codes to increase my knowledge for making a new site which exchange site.. thanks again for this guide..
full member
Activity: 210
Merit: 101
Thank you very much for this guide really it help me a lot
Its possible to make a bitcoin price like preev.com ?
For example I writ 0.0153 in bitcoin and i see the result in USD ?
Thanks again
Yup, Here are some steps how it will go:
- Get Current 1 BTC Rate
- Multiply Current BTC Rate with your value 'X'

In your case:
0.0153*458=7.021

Cheers.
full member
Activity: 210
Merit: 101
hero member
Activity: 696
Merit: 500
Thank you very much for this guide really it help me a lot
Its possible to make a bitcoin price like preev.com ?
For example I writ 0.0153 in bitcoin and i see the result in USD ?
Thanks again
legendary
Activity: 910
Merit: 1000
Thanks a lot for the real nice guide!

so if someone wants to show the price for different currencies, should do something like this?

Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];?>


echo "$last_price";
?>





$url "https://api.bitcoinaverage.com/ticker/global/EUR/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];?>


echo "$last_price";
?>





$url "https://api.bitcoinaverage.com/ticker/global/GBP/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];?>


echo "$last_price";
?>





$url "https://api.bitcoinaverage.com/ticker/global/JPY/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];?>


echo "$last_price";
?>





$url "https://api.bitcoinaverage.com/ticker/global/RUB/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];?>


echo "$last_price";
?>

and maybe add some css to format the output?
(was never good in php  Tongue)
full member
Activity: 210
Merit: 101
Added Guide for Altcoin Conversion

Introduction:
Hello All, Today i am going to tell you how to make your own currency converter using PHP and HTML. I know it seems to be difficult but when you understand it properly, it becomes a small piece of work for you. I will simply use https://bitcoinaverage.com/api to make it work. Let's Go.

Steps to Follow:
Kindly follow all the steps and read carefully to understand the meaning of each and every word, so it would be easier to do it yourself.

Step 1 - A Basic HTML Page:
First of all, You should create a basic HTML Page like this in any of your text editor:
Code:


Bitcoin Price Converter






Step 2 - PHP Script:
Now we will put PHP Coding to grab data using API. If you are not aware what is an API, Check this video: What is an API?
Let's start with creating a variable "$url". This variable will be used to grab data from the API Link i.e. https://api.bitcoinaverage.com/ticker/global/USD/
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
?>

Once we get our data from the API, We will have to decode it using JSON. Create a variable called $price in which we will store our decoded information.
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
?>

At this moment we have the API's Information in the variable called $price, It's time to get an exact data which we want i.e. last price. We will create a new variable called $last_price and will store the price in it.
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];
?>

You did it, we got all the data and it's time to show it. Simply use echo function of PHP to output the data:
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];
echo 
"$last_price";
?>

Step 3 - Integrate HTML with PHP:
Now put the PHP Code on the top of the HTML Page we created before like this:
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];
echo 
"$last_price";
?>




Bitcoin Price Converter






Step 4 - Auto Refresh Page (credit goes to KenR to remind me about this)
Our Converter is ready, we are going to add an auto refresh code to make it display the latest values. Simply add this code:
Code:

FINAL:
That's what we get!
Code:
$url "https://api.bitcoinaverage.com/ticker/global/USD/";
$price json_decode(file_get_contents($url), true);
$last_price $price['last'];
echo 
"$last_price";
?>




Bitcoin Price Converter







Tada! You did it Wink



Hope this Guide helped you in understanding the concept of API's, Drop me some comments to motivate Smiley
If you want to Donate, Please: 18L6tGTdJfCenGxzc8ZDLsjBNaUfekXzjj
Pages:
Jump to: