First of all id like to thanks for viewing my questions. The second, i appologize if my question are duplicate after all i searching there is no one match with my question. So here it is..
I have struggle when i want to parse the JSON data. I have try using all loops method it works but it only showing one data. Here is my json data :
{
"domain": [
{
"Domain": "countoftuscany.com",
"Created": "04/02/2018",
"IsOurDNS": "false",
"Expired": "04/02/2019"
},
{
"Domain": "gnesarssssis.com",
"Created": "04/01/2018",
"IsOurDNS": "false",
"Expired": "04/02/2019"
},
{
"Domain": "gnesarssis.com",
"Created": "04/01/2018",
"IsOurDNS": "false",
"Expired": "04/01/2019"
},
{
"Domain": "gnesarssi.com",
"Created": "04/01/2018",
"IsOurDNS": "false",
"Expired": "04/01/2019"
},
{
"Domain": "gnesarsi.com",
"Created": "04/01/2018",
"IsOurDNS": "false",
"Expired": "04/01/2019"
},
{
"Domain": "iniituadas.com",
"Created": "04/01/2018",
"IsOurDNS": "false",
"Expired": "04/01/2019"
}
],
"Perpage": "50",
"Total": "91",
"CurPage": "1"
}
Im using laravel 5.6.21 and XmlParser by orchestral on this case
The Code :
public function getList($page = null)
{
if (!$page) {$page = 1;}
$cache = 'DOMAIN-'.Auth::user()->id.'-'.$page;
if (Cache::has($cache)) {
$hasil = Cache::get($cache);
return $hasil;
$data = json_decode(json_encode($hasil));
// foreach ($data as $key) {
// dd($key);
// }
// return view('namecheap.show', compact('hasil'));
} else {
$url = $this->urlNc().'&Command=namecheap.domains.getList&ClientIp=119.81.31.23&PageSize=50&SortBy=EXPIREDATE_DESC&Page='.$page;
$resp = Curl::to($url)->get();
$xml = XmlParser::extract($resp);
$hasil = $xml->parse([
'domain' => ['uses' => 'CommandResponse.DomainGetListResult.Domain[::Name>Domain,::Created>Created,::IsOurDNS>IsOurDNS,::Expires>Expired]','default' => null],
]);
Cache::put($cache, $hasil, 10);
return $hasil;
return view('namecheap.show', compact('hasil'));
}
}
I want to get the "domain" data and then showing all of them. Could somebody please help me ? :( Please, i have try everything i know..