I followed a tutorial to import iCal data into my website using PHP. For some reason, the array doesn't seem to include any data even though the feed shows info in a feed validator website. Can anyone take a look at the decoder function? I'm guessing there's a simple reason for this but I'm a novice.
public function iCalDecoder($file) {
$ical = file_get_contents('https://www.google.com/calendar/ical/689afn1fkt0cb59kame9bg56mg%40group.calendar.google.com/private-584915c30803f5ad6c548f021e84f836/basic.ics');
preg_match_all('/(BEGIN:VEVENT.*?END:VEVENT)/si', $ical, $result, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($result[0]); $i++) {
$tmpbyline = explode("rn", $result[0][$i]);
foreach ($tmpbyline as $item) {
$tmpholderarray = explode(":",$item);
if (count($tmpholderarray) >1) {
$majorarray[$tmpholderarray[0]] = $tmpholderarray[1];
}
}
if (preg_match('/DESCRIPTION:(.*)END:VEVENT/si', $result[0][$i], $regs)) {
$majorarray['DESCRIPTION'] = str_replace(" ", " ", str_replace("rn", "", $regs[1]));
}
$icalarray[] = $majorarray;
unset($majorarray);
}
return $icalarray;
}