<?php

$key = "aa9f8e-bb2b3f-61fa01-587b63-188230"; // your api key
$postdata = "api_key=$key&api_id=2068";
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://irvankedesmm.co.id/api/services");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$chresult = curl_exec($ch);
//echo $chresult;
curl_close($ch);
$json_result = json_decode($chresult, true);
$indeks=0;
$i = 1;
// get data service
while($indeks < count($json_result['data'])){
   
$category=$json_result['data'][$indeks]['category'];
$average=$json_result['data'][$indeks]['average'];
$id =$json_result['data'][$indeks]['id'];
$service = $json_result['data'][$indeks]['name'];
$min_order =$json_result['data'][$indeks]['min'];
$max_order = $json_result['data'][$indeks]['max'];
$price = $json_result['data'][$indeks]['price'];
$note = $json_result['data'][$indeks]['note'];
$status = $json_result['data'][$indeks]['status'];
$indeks++;

echo "<br>Kategori : $category || SID : $id || Service :$service || Min :$min_order || Max : $max_order ||Price : $rate_asli || Kec rata-rata : $average || Note : $note <br><br />";
}