Bitcoin Forum
December 08, 2024, 06:10:10 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: api script  (Read 173 times)
guldenpagina.nl (OP)
Member
**
Offline Offline

Activity: 183
Merit: 11


View Profile WWW
October 04, 2017, 10:37:25 AM
 #1

I got this script for Gulden I have 1 question
Code:
<h5 style="text-align: center;">Laatst gekocht = [insert_php]
$url = 'https://www.nocks.com/api/market?call=nlg';
$response = file_get_contents($url);
$obj = json_decode($response, true);
echo ''. $obj['last'] . ''; [/insert_php] EURO</h5>

Its show with 0000 after the price, I think its someting from the $obj
My question I wat delete the 0000 after the ,
btct22
Hero Member
*****
Offline Offline

Activity: 615
Merit: 502



View Profile
October 04, 2017, 11:04:34 AM
 #2

I got this script for Gulden I have 1 question
Code:
<h5 style="text-align: center;">Laatst gekocht = [insert_php]
$url = 'https://www.nocks.com/api/market?call=nlg';
$response = file_get_contents($url);
$obj = json_decode($response, true);
echo ''. $obj['last'] . ''; [/insert_php] EURO</h5>

Its show with 0000 after the price, I think its someting from the $obj
My question I wat delete the 0000 after the ,

Try changing the output line to:

Code:
echo ''. number_format($obj['last'],0) . ''; [/insert_php] EURO</h5>
btct22
Hero Member
*****
Offline Offline

Activity: 615
Merit: 502



View Profile
October 04, 2017, 11:58:37 AM
 #3

Solved its

Code:
echo ''. number_format($obj['last'],4) . ''; [/insert_php] EURO</h5>

I should have called the API first to know what the format was, I though you meant after the decimal place Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!