BTC:USD on PHP

Hello.
I can get through the API course BTC to USD on PHP.

1 Like
$WBTC = '8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS';
$WUSD = 'Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck';
$api = "https://api.wavesplatform.com/v0/pairs?pairs=$WBTC/$WUSD";

$json = json_decode( file_get_contents( $api ), true );
$price = $json['data'][0]['data']['lastPrice'];

echo $price;
1 Like

Thnx!!!
Where can I get numbers of other currencies?

1 Like

Thank you, very much!!! :+1::+1::+1:

Why a can’t get this pairs? Empty array (

$USD = ‘Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck’;
$LTC = ‘HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk’;
$json = json_decode(file_get_contents(“https://api.wavesplatform.com/v0/pairs?pairs=$LTC/$USD”), true);

Because there is no trades on DEX in 24 hours on LTC/USD pair.

ОК.
I want to display on my site the cost of a BTC LTC ETH in USD.
How best to do this?

If you want DEX numbers, use your own cache system of numbers above.

I will be completely honest.
I have little knowledge of cryptocurrency and tokens.
I’m just a programmer.
I was given the task to display the cost of cryptocurrency on the website using the Waves platform.
So I need the easiest way to get prices.

You’re not acting like a programmer.

This screenshot is from an official wavesplatform client. Do you see LTC / USD price?

image

So, it looks like if you rely just on the API (the easiest way), you wouldn’t finish the task. Good luck.