I think you can convert an array into json object first…
I will give you an example how to parse a json object then catch variables then insert into table.
Below are my full code parse from url that contain json
$curl=curl_init();
curl_setopt_array($curl,array(
CURLOPT_URL => “http://…json url”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “GET”,
));
$response=curl_exec($curl);
$err=curl_error($curl);
curl_close($curl);
if($err)
{echo 'cURL Error #: '.$err;}
else
{
$resultarr = json_decode($response, true);
$tanggal=$resultarr[‘data’][‘0’][‘tanggal’];
sc_lookup(tgl1,“SELECT CURRENT_DATE”);
$tanggal1={tgl1[0][0]};
sc_exec_sql(“delete from your table”);
//POPULATE RESULT
$FINALRESULT = $resultarr[‘data’];
$all_values = [];
$query = "INSERT INTO your table (idne,kelurahan,odr,otg,odp,odpdp,odpsp,odpm,pdp,pdpdp,pdpsp,pdpm,p,ps,pm,pd,pi,tanggal,created_at) VALUES ";
foreach($FINALRESULT as $key) {
$row_values = [];
foreach($key as $s_key => $s_value) {
$row_values[] = “’”.$s_value."’";
}
$all_values[] = ‘(’.implode(’,’, $row_values).’)’;
}
//Implode all rows
$query .= implode(’,’, $all_values);
//$sql1=“select replace($query,’”’,’’’";
$query=str_replace("’’","‘0’",$query);
//$query=str_replace(’’’’,"‘0’",$query);
//echo $query;
sc_exec_sql($query);
}
sc_redir(http://…);