BTC:USD on PHP


#1

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


#2
$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;

#3

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


#4

#5

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


#6

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);


#7

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


#8

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


#9

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


#10

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.


#11

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.