Jump to content

Recommended Posts

Hi everyone,

 

I have this php code in which I can apply a number format feature when echoing $ask:

 

<!DOCTYPE html>
<html>
<body>
  <?php
    $json_string = file_get_contents("https://api.flowbtc.com:8400/GetTicker/BTCBRL/");
    $parsed_json = json_decode($json_string);
    $ask = $parsed_json->{'ask'};
    echo number_format($ask, 2, ',', '');
  ?>
</body>
</html>
 
However, when I do it within an array so it works with my Messenger chatbot, it simply doesnt work.
 
In the example below how can I do the number formating in the result of .$ask * 1.025 on the "value" line?
 
<?
 
header('Content-Type: application/json');
////Text / Image / Structured
 
/// $_POST['message'];   /// Message user Inputs
/// $_POST['senderid'];   /// Facebook Sender ID
///
 
    $json_string = file_get_contents("https://api.flowbtc.com:8400/GetTicker/BTCBRL/");
    $parsed_json = json_decode($json_string);
    $ask = $parsed_json->{'ask'};
 
 
 
$received_message = $_POST['message'];
 
$message = array();
 
 
///Text Message
$message['bmsg'][0] = array(
'type'=>'text',
                                 'value'=>'Valor de referencia de 1 bitcoin incluindo taxas: R$ ' .$ask * 1.025
);
 
echo json_encode($message);
 
?>
 
 
Any help will be appreciated. Thanks!!!
 
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.