<?php $json_url = "http://openexchangerates.org/api/latest.json?app_id=xxxxx&callback=angular.callbacks._0"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $json_url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $response = curl_exec($curl); $jsonString = json_encode($response, true); $data=json_decode($jsonString); echo '<pre>',print_r($data),'</pre>'; $status = curl_getinfo($curl); curl_close($curl);
Output:
angular.callbacks._0({ "disclaimer": "xx", "license": "xx", "timestamp": 1368136869, "base": "USD", "rates": { "AED": 3.672819, "AFN": 53.209, "ALL": 107.953875, "AOA": 96.358934, "ARS": 5.214887, .... "XOF": 501.659003, "XPF": 91.114876, "ZMK": 5227.108333, "ZMW": 5.314783, "ZWL": 322.387247 } })
But I need to edit this output for this (with only three bets (AED / AFN / AOA)). So basically edit the json answer in the betting section. How can i do this?
angular.callbacks._0({ "disclaimer": "xx", "license": "xx", "timestamp": 1368136869, "base": "USD", "rates": { "AED": 3.672819, "AFN": 53.209, "AOA": 107.953875, } })