I'm trying to handle the response from a cURL request that returns a JSON with some date and other data i don't need. I'm trying to access the data from the dates to show them in a calendar in my app, but I'm not able to access the information at all. I've checked other similar questions but none of the solutions worked for me. This is my code:
<?php
$data = "{}";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://******",
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data,
CURLOPT_FOLLOWLOCATION => true,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$decode = json_decode($response, true);
var_dump($decode);
var_dump($response);
This is the response i get:
{
calendar: {
holidays: [
"12/10/2018",
"01/11/2018",
"09/11/2018",
"06/12/2018",
"19/04/2019",
"01/05/2019"
],
nonTeaching: [
"24/12/2018",
"02/11/2018",
"26/12/2018",
"07/12/2018",
"27/12/2018",
"12/04/2019",
"28/12/2018",
"03/05/2019",
"28/04/2019"
],
events: [
{
other info
}
I'm trying to access the dates from holidays and nonTeaching, but so far I haven't been able to. The var_dump just returns "1" or true.
What am I doing wrong?
Thank you very much in advance.