I'm trying to get data from API and I receive this
[
{
"service": 1,
"name": "Followers",
"type": "Default",
"category": "First Category",
"rate": "0.90",
"min": "50",
"max": "10000"
},
{
"service": 2,
"name": "Comments",
"type": "Custom Comments",
"category": "Second Category",
"rate": "8",
"min": "10",
"max": "1500"
}
]
I want to get the category for each service without repeating the same category twice.
Edited* I have this code
$servers = $this->Setting->Loop('api','WHERE is_active = 1');
foreach($servers->result() as $server){
foreach($this->Api_Connect->services($server->api_url, $server->api_key) as $item) {
echo '<option data-server='.$server->id.' data-percent='.$server->addon_percent.' data-price='.$item['rate'].' data-min='.$item['min'].' data-max='.$item['max'].' value="'.$item['service'].'">- '.$item['name'].'</option>';
}
}
which connect to each server with api url and key and return with the services.