mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 22:09:07 +00:00
Add Coinbase ETH spot price example
This commit is contained in:
@@ -5,8 +5,8 @@ use \Curl\Curl;
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->setHeader('CB-VERSION', '2016-01-01');
|
||||
$curl->get('https://api.coinbase.com/v2/prices/spot');
|
||||
$curl->get('https://api.coinbase.com/v2/prices/BTC-USD/spot');
|
||||
|
||||
echo
|
||||
'The current price of bitcoin at Coinbase is ' .
|
||||
'The current price of BTC at Coinbase is ' .
|
||||
'$' . $curl->response->data->amount . ' ' . $curl->response->data->currency . '.' . "\n";
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use \Curl\Curl;
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->setHeader('CB-VERSION', '2016-01-01');
|
||||
$curl->get('https://api.coinbase.com/v2/prices/ETH-USD/spot');
|
||||
|
||||
echo
|
||||
'The current price of ETH at Coinbase is ' .
|
||||
'$' . $curl->response->data->amount . ' ' . $curl->response->data->currency . '.' . "\n";
|
||||
Reference in New Issue
Block a user