@ 2018-10-31T13:02:01Z <?php
$curl_response = '{
"options": {
"ranking_metric": "paid_impressions",
"time_interval": "day",
"report_type": "time",
"filters": {
"pid": "2759"
},
"data_source": "detailed",
"format": "json",
"end_date": "2018-10-28 23:59",
"columns": ["paid_impressions", "revenue"],
"time_zone": "UTC",
"start_date": "2018-10-26 00:00"
},
"api_url": "http://udmserve.com/udm/radalytics_api.cpx?action=report&api_key=xxxx&api_key=xxxx",
"time": 1540989662,
"rows": [{
"paid_impressions": "18136",
"timestamp": "2018-10-26 00:00",
"_combined_val": "",
"ranking_col": "49046",
"revenue": "28.461629999999985",
"rank": "1",
"f0_": ""
}, {
"paid_impressions": "14432",
"timestamp": "2018-10-27 00:00",
"_combined_val": "",
"ranking_col": "49046",
"revenue": "25.707970000000017",
"rank": "1",
"f0_": ""
}, {
"paid_impressions": "16478",
"timestamp": "2018-10-28 00:00",
"_combined_val": "",
"ranking_col": "49046",
"revenue": "29.07676000000002",
"rank": "1",
"f0_": ""
}]
}';
$array = json_decode($curl_response,true);
foreach($array['rows'] as $arr){
echo explode(' ',$arr['timestamp'])[0].'-'.number_format((float)$arr['revenue'], 2, '.', '').' USD'.PHP_EOL;
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.19 , 8.3.0 - 8.3.4 , 8.3.6 - 8.3.7 2018-10-26-28.46 USD
2018-10-27-25.71 USD
2018-10-28-29.08 USD
Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
2018-10-26-28.46 USD
2018-10-27-25.71 USD
2018-10-28-29.08 USD
preferences:dark mode live preview
237.54 ms | 402 KiB | 289 Q