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!!!