Bitcoin Forum

Alternate cryptocurrencies => Service Discussion (Altcoins) => Topic started by: jailee on March 10, 2015, 03:33:21 PM



Title: Enter API Info
Post by: jailee on March 10, 2015, 03:33:21 PM
I want to put this API info on a site so as to recieve all the available data. http://www.cryptocoincharts.info/tools/api
How do I do that?


Title: Re: Enter API Info
Post by: CryptoDatabase on March 10, 2015, 07:30:43 PM
I want to put this API info on a site so as to recieve all the available data. http://www.cryptocoincharts.info/tools/api
How do I do that?

What specifically are you looking to add? Each api they offer has example codes listed for them.

For example if you wanted to list all of the coins they track you would use the following code,

Code:
<?php
// fetch data
$curl curl_init();
curl_setopt($curlCURLOPT_URL"http://api.cryptocoincharts.info/listCoins");
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
$rawData curl_exec($curl);
curl_close($curl);

// decode to array
$data json_decode($rawData);

// show data
echo "<pre>";
foreach ($data as $row) echo $row->id." - ".$row->name."\n";
echo "</pre>";
?>


P.S. Big shout out to CryptoCoinCharts, I use their API for Crypto Database to show pricing information and to track coins highs and lows.


Title: Re: Enter API Info
Post by: jailee on March 10, 2015, 11:32:44 PM
I want to put this API info on a site so as to recieve all the available data. http://www.cryptocoincharts.info/tools/api
How do I do that?

What specifically are you looking to add? Each api they offer has example codes listed for them.

For example if you wanted to list all of the coins they track you would use the following code,

Code:
<?php
// fetch data
$curl curl_init();
curl_setopt($curlCURLOPT_URL"http://api.cryptocoincharts.info/listCoins");
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
$rawData curl_exec($curl);
curl_close($curl);

// decode to array
$data json_decode($rawData);

That doesnt do anything except put code on my page

// show data
echo "<pre>";
foreach ($data as $row) echo $row->id." - ".$row->name."\n";
echo "</pre>";
?>


P.S. Big shout out to CryptoCoinCharts, I use their API for Crypto Database to show pricing information and to track coins highs and lows.


Title: Re: Enter API Info
Post by: jailee on March 11, 2015, 12:59:03 AM
Nothing happens, that just puts code on my page :-\


Title: Re: Enter API Info
Post by: CryptoDatabase on March 11, 2015, 01:38:43 AM
Nothing happens, that just puts code on my page :-\

What information are you wanting the information to show? For example, 'Joe wants to find the price between BTC and LTC what does he do?' or no?


Title: Re: Enter API Info
Post by: jailee on March 13, 2015, 12:38:54 PM
I just want to get it to show ANY information. That would be nice. WHERE DO I PLUG IN THE API INFORMATION? on that website there is this.
List coins
Use this function to list all coins with their data which are available on cryptocoincharts.

URL: GET http://api.cryptocoincharts.info/listCoins
RESULT: array with coins objects
id: coin ID
name: coin name
website: URL of website if available
price_btc: last traded price of best market
volume_btc: 24h trading volume recalculated to BTC
PHP example
   // fetch data
   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, "http://api.cryptocoincharts.info/listCoins");
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
   $rawData = curl_exec($curl);
   curl_close($curl);
   
   // decode to array
   $data = json_decode($rawData);
   
   // show data
   echo "<pre>";
   foreach ($data as $row) echo $row->id." - ".$row->name."\n";
   echo "</pre>";


Where do I put this URL: GET http://api.cryptocoincharts.info/listCoins


Title: Re: Enter API Info
Post by: CryptoDatabase on March 13, 2015, 06:16:54 PM
I just want to get it to show ANY information. That would be nice. WHERE DO I PLUG IN THE API INFORMATION? on that website there is this.
List coins
Use this function to list all coins with their data which are available on cryptocoincharts.

URL: GET http://api.cryptocoincharts.info/listCoins
RESULT: array with coins objects
id: coin ID
name: coin name
website: URL of website if available
price_btc: last traded price of best market
volume_btc: 24h trading volume recalculated to BTC
PHP example
   // fetch data
   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, "http://api.cryptocoincharts.info/listCoins");
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
   $rawData = curl_exec($curl);
   curl_close($curl);
   
   // decode to array
   $data = json_decode($rawData);
   
   // show data
   echo "<pre>";
   foreach ($data as $row) echo $row->id." - ".$row->name."\n";
   echo "</pre>";


Where do I put this URL: GET http://api.cryptocoincharts.info/listCoins

The example tells you. All of their examples are fully functioning code that you place <?php ?> tags around and place anywhere on a .php file.