Bitcoin Forum
September 19, 2019, 08:27:25 PM *
News: If you like a topic and you see an orange "bump" link, click it. More info.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BTC to USD (or similar currency)  (Read 813 times)
sandaq
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
August 25, 2016, 05:58:29 AM
 #1

I'm looking for a php (or javascript) function to replace BTC to USD just like the one google uses https://www.google.co.il/search?q=btc+to+usd&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&ei=IIi-V-LaPMyN8QeGkI_YBQ

This should be something that prints the USD price automatically when you enter the BTC or vice versa, not something that you have to press submit and then it gets the price for you, this I already have:

Code:
$url = "https://api.bitcoinaverage.com/ticker/ILS/";
$json = json_decode(file_get_contents($url), true);
$price = $json["last"];

It needs to be automatically. There's no need for all the currencies. Just btc to usd (I will change the currency later) that will be shown automatically.

1568924845
Hero Member
*
Offline Offline

Posts: 1568924845

View Profile Personal Message (Offline)

Ignore
1568924845
Reply with quote  #2

1568924845
Report to moderator
1568924845
Hero Member
*
Offline Offline

Posts: 1568924845

View Profile Personal Message (Offline)

Ignore
1568924845
Reply with quote  #2

1568924845
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1568924845
Hero Member
*
Offline Offline

Posts: 1568924845

View Profile Personal Message (Offline)

Ignore
1568924845
Reply with quote  #2

1568924845
Report to moderator
1568924845
Hero Member
*
Offline Offline

Posts: 1568924845

View Profile Personal Message (Offline)

Ignore
1568924845
Reply with quote  #2

1568924845
Report to moderator
sandaq
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
August 25, 2016, 11:35:28 AM
 #2

To whoever is interested I found out how to do it. It's still a bit crude but works:

Code:
<?

$margin=1.05;
$nigram=0.95;

$url = "https://api.bitcoinaverage.com/ticker/ILS/";
$json = json_decode(file_get_contents($url), true);
$price = $json["last"];
?>

<head>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>

<input type="text" id="BTC" value="1">
<input type="text" id="ILS" value="">

<?

echo "<script>";
echo "$( \"#BTC\" )";
echo ".keyup(function() { var BTCprice = $( this ).val();";
echo "if($.isNumeric(BTCprice) === false) { this.value = this.value.slice(0,-1); }";
echo " $( \"#ILS\" ).val( BTCprice * ".$price * $margin." ); })";
echo ".keyup();";
echo "$( \"#ILS\" )";
echo ".keyup(function() { var ILSprice = $( this ).val();";
echo "if($.isNumeric(ILSprice) === false) { this.value = this.value.slice(0,-1); }";
echo "var ILSprice = ILSprice / ".$price / $nigram ."; var i = ILSprice.toFixed(8);";
echo " $( \"#BTC\" ).val( i ); })";
echo ".keyup();";
echo "</script>";
?>

sandaq
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
August 26, 2016, 05:02:36 PM
 #3

The above code has been implemented on my site. Check it out: https://www.spice.co.il/en/buy.php

amacar2
Legendary
*
Offline Offline

Activity: 1092
Merit: 1003


Varanida : Fair & Transparent Digital Ecosystem


View Profile
August 26, 2016, 06:46:55 PM
 #4

The above code has been implemented on my site. Check it out: https://www.spice.co.il/en/buy.php
What actually is ILS? quite confusing but it seem script is working and enough to get exchange rate.

iBuilding A Better Interneti
━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━

 
 █b
▐█=
║█
██                                         ¡▄▄▄▄▄▄▄▄┌
██M                                  ╒▄▄▄▄█▀    ▂▂ ╙▀▀▆▄
██▌                                ╓, ,██╨      ▀▀▀    ╜▀█▌
███                                ▀▀██╙     ▄▄▄▄▄      ╓█L
█ █▌                            ▄▄▄▄█▀          └▀▀▀▀█Φ█▀"
█▌ █▄                            ██▀           ▄█▀
▐▌  ▀▌                       ▀▄██▀            ▄▀
▐█     ▂▂▂                ▄  ▄█▀           ▄▄▀
 █▌  ╙▀▀▀▀▀█▄         ▄   ███▀     ▁▂▃▄▄▄█▀▀
  █▄        █▌    █▄  ██▄█▀        ▔▔╙▀▐█
   █▄       █▌ ▀▀████▀▀▀               ▐▌
    ▀█     █▀                          ▐▌
     ╙█▄  ▄▌                        ╓█ ▐█
       └▀██  ╓▄▄µ╓▄▄µ            ,▄█▀┘  █▌    ▄▄ ╓▄▄µ
         ██▄█▀▀███▀▀█▄       ╓▄▄█▀▀      ▀█▄█▀▀▀██▄╙▀█▄▄
          ▀╙    ▀▀▀  ▀▀▀  ▀▀▀▀╙           `      "▀▀  └╙
You Can See Me Now, Hi :}
VARANIDA

 
 
 
 
               ▄██   ▄███▄
              ▄███████  ██
              ██    ▀████▀
             ██
  ▄▄  ▄▄█████████████▄▄  ▄▄
▄███████████████████████████▄
█████████████████████████████
▀███████    █████    ███████▀
  ▀█████    █████    █████▀
   ███████████████████████
    █████▄  ▀▀▀▀▀  ▄█████
     ▀█████▄▄▄▄▄▄▄█████▀
        ▀▀█████████▀▀
|Hello Again
GWhitePaperG
GAnn ThreadG
sandaq
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
August 26, 2016, 08:06:53 PM
 #5

ILS is Israeli currency. about 3.7 ILS worth 1 USD.

Patatas
Legendary
*
Offline Offline

Activity: 1638
Merit: 1105


Crypto-Games.net: Multiple coins, multiple games


View Profile
August 27, 2016, 07:43:43 AM
 #6

ILS is Israeli currency. about 3.7 ILS worth 1 USD.
Please change the blue background solid color from the website.Literally hurting my eyes.I kind of figured out 2757 ILS = 1 Bitcoin.So basically you sell bitcoins,how is anyone suppose to pay you from bank transfer without using a escrow ?


▄▄▄████████▄▄▄
▄██████████████████▄
▄██████████████████████▄
██████████████████████████
████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
████████████████████████████
██████████████████████████
▀██████████████████████▀
▀██████████████████▀
▀▀▀████████▀▀▀
   ███████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
██████████
███████
BTC  ◉PLAY  ◉XMR  ◉DOGE  ◉BCH  ◉STRAT  ◉ETH  ◉GAS  ◉LTC  ◉DASH  ◉PPC
     ▄▄██████████████▄▄
  ▄██████████████████████▄        █████
▄██████████████████████████▄      █████
████ ▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄ ████     ▄██▀
████ █████ ██████ █████ ████    ▄██▀
████ █████ ██████ █████ ████    ██▀
████ █████ ██████ █████ ████    ██
████ ▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀▀ ████ ▄██████▄
████████████████████████████ ████████
███████▀            ▀███████ ▀██████▀
█████▀                ▀█████
▀██████████████████████████▀
  ▀▀████████████████████▀▀ 
✔️DICE           
✔️BLACKJACK
✔️PLINKO
✔️VIDEO POKER
✔️ROULETTE     
✔️LOTTO
sandaq
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
August 27, 2016, 12:41:34 PM
 #7

Please change the blue background solid color from the website.Literally hurting my eyes.I kind of figured out 2757 ILS = 1 Bitcoin.So basically you sell bitcoins,how is anyone suppose to pay you from bank transfer without using a escrow ?

The background has been changed. I'm still developing the sites. The will also be a credit card ability to pay for bitcoins and probaby cash. We are a legit company just like you buy anything on the internet without escrow you can buy with us.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!