mmottola24 / calfileparser Goto Github PK
View Code? Open in Web Editor NEWParser for iCal and vCal. Outputs event information in Array or JSON
Parser for iCal and vCal. Outputs event information in Array or JSON
return one record of attendee only ?
input
ORGANIZER;RSVP=TRUE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:123@456com
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:[email protected]
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:[email protected]
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:[email protected]
output
[organizer;rsvp=true;partstat=accepted;role=chair] => mailto:[email protected]
[attendee;rsvp=true;partstat=needs-action;role=req-participant] => mailto:[email protected]
I am having trouble creating a 2-dimentional array from converted json data as structure appear to be missing parent "data".
Trying to output only "dtstart" and "summary" fields
Any suggestions would be greatly appreciated. Thanks
One of .ics cals I tried to import had this line inside VEVENT:
DTSTART;TZID=Europe/Bratislava;VALUE=DATE:20060101
which caused
Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (Europe/Bratislava;VALUE=DATE)
A workaround is add a line after 309. After:
$timezone = substr($strstr, 5);
i added
$timezone=explode(";",$timezone)[0];
I've just want to share something I've added to the code because when I was trying to parse an ical from an URL that has special characters, some fields where broken after saving them in my DB.
In CalFileParser.php, line 101:
Original:
return data
Improvement (found in Stack Overflow):
return mb_convert_encoding($data, 'UTF-8', mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true));
If you want to add it it will be great ^-^
Thanks for your work!
Apples Calendar app (formerly known as iCal) works very well except for one problem with the parser. It seems to skip the "extra" EXDATEs that come with the calendar. Apple composes them like this when there are several EXDATEs:
EXDATE;TZID=Europe/Stockholm:20160401T140000
EXDATE;TZID=Europe/Stockholm:20160408T140000
EXDATE;TZID=Europe/Stockholm:20160325T140000
Instead of the standard iCal way:
EXDATE:20160401T140000,20160408T140000,20160325T140000
(Dont worry about the TZID part, i regex that away)
I am not very experienced with PHP yet so that is why I need help with this small problem.
Hope you (or somebody) still are active and caring enough to help me with this. Thanks!
Sometimes the .ics file doesn't give access unless you behave like a browser. It works to replace line 106
$data = file_get_contents($file);
with something like the following:
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" . // check function.stream-context-create on php.net
"User-Agent: CalFileParser/1.0"
)
);
$context = stream_context_create($options);
$data = file_get_contents($file, false, $context);
Not an issue really. I had a vcal feed that I needed to add UIDs to before importing and this script did the heavy lifting. Thanks a ton.
I'm confronted with a ics file which don't have any timezone values in it
VERSION:2.0
PRODID:xy
METHOD:PUBLISH
BEGIN:VEVENT
UID:20140925T175944CEST-0480Sdk86c@xy
DTSTAMP:20140925T155944Z
DESCRIPTION:This is a test
DTSTART:20140727T150000
DTEND:20140727T170000
SUMMARY:This is the summary
END:VEVENT
Such ics files can't be processed with your parses because
Warning: DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, null given in /kunden/277447/url/CalFileParser.php on line 258
How to handle that?
Can you integrate a "default timezone" paramater which is used in such cases when the ics file has no timezone in it?
Hello,
Would you mind registering this library on packagist.org?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.