1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
<?php
// Les crochets qui délimitent le JSON indiquent qu'il s'agit d'une collection de données
$json_source = '[
{
"identifier": "120568470",
"amount": 30.24,
"payout_type": "percent",
"mode": "share",
"currency": "EUR",
"is_pending": false,
"locked_at": 1483725042,
"created_at": 1478946262,
"conversion_id": {
"$id": "5826edd6caf95b0a638eb47d"
},
"refused_at": null,
"refuse_reason": null,
"id": "5826edd6caf95b0a638eb47b",
"partnership": {
"id": "57f3da7d665e88c3358bc11e"
},
"group": {
"id": "55c86be6665e8865638b46a0"
},
"affiliateProfile": {
"id": "57f3da7d665e88c3358bc11d",
"title": "CFC"
},
"percent": 33.33,
"commission": 0.5,
"referrer": null,
"cookie": 1478944951,
"landing_page": "",
"custom_var": "",
"cpc": 0,
"cpc_currency": "EUR",
"weight": 5,
"commission_rate": 5,
"tracking_id": 3,
"paymentRequest": {
"id": "58931a63e8face8f3b8b4578",
"created_at": 1486035554
}
},
{
"identifier": "120568470",
"amount": 30.24,
"payout_type": "percent",
"mode": "share",
"currency": "EUR",
"is_pending": false,
"locked_at": 1483725042,
"created_at": 1478946262,
"conversion_id": {
"$id": "5826edd6caf95b0a638eb47d"
},
"refused_at": null,
"refuse_reason": null,
"id": "5826edd6caf95b0a638eb47c",
"partnership": {
"id": "57f3da7d665e88c3358bc11e"
},
"group": {
"id": "55c86be6665e8865638b46a0"
},
"affiliateProfile": {
"id": "57f3da7d665e88c3358bc11d",
"title": "CFC"
},
"percent": 33.33,
"commission": 0.5,
"referrer": null,
"cookie": 1478945625,
"landing_page": "",
"custom_var": "",
"cpc": 0,
"cpc_currency": "EUR",
"weight": 5,
"commission_rate": 5,
"tracking_id": 3,
"paymentRequest": {
"id": "58931a63e8face8f3b8b4578",
"created_at": 1486035554
}
}
]';
// On va boucler sur un tableau
$json_data = json_decode($json_source, true);
foreach($json_data as $v){
echo $v['amount'].'<br>';
echo $v['commission'].'<br>';
}
?> |