Importing iCal calendar into MySQL database

2019-06-09 11:17发布

问题:

I've searched through a lot of sites, but all of them do in reverse already what I've achieved , but not what I need.

I need a way to import data FROM ICAL into a MySQL database, actually just one table and a few columns in a WordPress database. But I'm ignoring WordPress (as it messed up my export) and using direct database connection.

Can any of you help me achieve this? Is importing ICAL so obviously simple that I'm thinking way too difficult?

My ICAL docs setup:

BEGIN:VCALENDAR
VERSION:2.0C
ALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-TIMEZONE:Europe/Amsterdam
BEGIN:VEVENT
DTSTART:20120113T133300
DTEND:20120223T165900
DTSTAMP:20120118T093232
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:29007/on/on
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

From "BEGIN:" to "END:" also gets repeated when a user exports multiple events. In status I've currently (will change to something else) a post ID, whether or not the event is "on"(true) meaning to be displayed (in order to preserve data of past events), and the 2nd "on" tells the front end whether an event is an all-day event (from 00:00 until 23:59).

So again the question, how could I import this, using just a few lines of code, not a plugin or some other external code, into my table in a WP database?

Thanks in advance!

P.s. -> I just made this profile, not here to leech knowledge, before I created the profile just now I've also answered questions anonymously and corrected some answers in which I spotted mistakes.

回答1:

The next is not a universal tool, but may suit your needs

iCal Export/Import Tool for dhtmlxScheduler