hello everyone.
im working on a json from this site. im trying to get the "last" key and
im trying to echo my own premiunm exchange rate.by getting 10% of the last key and add it up to the last key
my codes was like this
<code>
<?php
$url = " $fileGet = file_get_contents($url);
$json = json_decode($fileGet, TRUE);
$json = $json["ticker"]["last"];
$premium = 10; //in percentage
$premium = $premium / 100;
$dollar_amount = $premium * $json;
$customer_price = $json + $dollar_amount;
echo $customer_price;
?>
</code>
there was no error indicated.but it just printed "0" on the screen.
please help. i dont know where something does wrong.
but everything work fine to line 4 $json=$json["ticker"]["last"]; because it print the correct last ticker on the browser.
im working on a json from this site. im trying to get the "last" key and
im trying to echo my own premiunm exchange rate.by getting 10% of the last key and add it up to the last key
my codes was like this
<code>
<?php
$url = " $fileGet = file_get_contents($url);
$json = json_decode($fileGet, TRUE);
$json = $json["ticker"]["last"];
$premium = 10; //in percentage
$premium = $premium / 100;
$dollar_amount = $premium * $json;
$customer_price = $json + $dollar_amount;
echo $customer_price;
?>
</code>
there was no error indicated.but it just printed "0" on the screen.
please help. i dont know where something does wrong.
but everything work fine to line 4 $json=$json["ticker"]["last"]; because it print the correct last ticker on the browser.