lundi 2 octobre 2017

Laravel Display USD Product mysql Price exchanged from Bitcoin

I have an liitle store with Products where all the Price are in Bitcoin also in Mysql Database in this formate:

 @else 

Now i want display the Bitcoin Price from database in USD live rate with Curl.

Whats the best method for it?

I have try it with this code,any other working ideas?:

<?php  
  $url = "http://ift.tt/19jUGsx";

  $json = file_get_contents($url);
  $data = json_decode($json, TRUE);

  $rate = $data[1]["rate"];    
  $usd_price = DB::table('products')->whereIn('category_id')     
  $bitcoin_price = round( $usd_price / $rate , 8 );
?>

<ul>
   <li>Price: <?=$usd_price ?> $ / <?=$bitcoin_price ?> BTC
</ul>



via Chebli Mohamed

2 commentaires:

  1. YoBit lets you to claim FREE COINS from over 100 unique crypto-currencies, you complete a captcha one time and claim as much as coins you want from the available offers.

    After you make about 20-30 claims, you complete the captcha and keep claiming.

    You can press CLAIM as much as 50 times per one captcha.

    The coins will safe in your account, and you can exchange them to Bitcoins or Dollars.

    RépondreSupprimer
  2. BitKONG - Fun and addictive, provably fair bitcoin guessing game.

    And most importantly, Claim bitcoins every 10 minutes from the faucet.

    RépondreSupprimer