3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get the original answer $answer = $output['answer']; // Get gold price from external API // // https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json $start_date = date('Y-m-d', strtotime('-3 days')); $json_string = file_get_contents("https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=$start_date"); $json_object = json_decode($json_string,true); $gold_price = $json_object['dataset']['data'][0]['1']; // Update the answer by filling the gap XXXX with the actual value of gold $answer = str_replace('XXXX', $gold_price , $answer); // send the answer to Alexa $output['answer'] = $answer; ?>

preferences:
58.78 ms | 402 KiB | 5 Q