Jump to content

marcmira

New Members
  • Posts

    3
  • Joined

  • Last visited

marcmira's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I managed to do this by creating another variable before the array using the number format funciton and then replacing .ask with this new variable in the array.
  2. Thanks Sen but either my chatbot doesnt accept this syntax or it is not working for another reason. Any other ideas?
  3. 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!!!
×
×
  • 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.