Sync multiple iCalendars (Airbnb, Flipkey, Google Calendar, etc)

混江龙づ霸主 提交于 2019-12-09 07:03:31

问题


I'm developing a website for apartments rental. I'm using a wordpress hotel theme that I tweaked so instead of "rooms" it uses "flats" and a booking plug-in. Each of this flats are also advertised in Airbnb and FlipKey.

What I need is to able to sync all the calendars so if, for instance, someone books the flat in Airbnb, that flat is automatically marked as "non available" in both the website and Flipkey. This is done using feeds .ics that are provided by both companies. There is an output feed and an input feed for both, so if I paste the output in the input of the other and vice versa, the thing works perfectly.

Now, what I need is a way of centralizing both calendar in one system and using that system to feed the inputs of Airbnb, Flipkey and my own booking plugin of wordpress. I've tried that with:

PHP iCalendar (it can, as google calendar, get the feeds, but it doesn't -as far as I know- provide an unified output). Services as http://www.accommodationcalendar.com only get the input, but no output either.

Maybe http://www.davical.org/ could be a good option, but as I'm using a shared hosting, I can't install it (as far as I know) -the reason being that the shared hosting only has MySql and not PostgreSQL.

Does anyone have an idea of how solve this?

THANK YOU!


回答1:


After some research, I found this solution:

1) Use this library: http://kigkonsult.se/iCalcreator/

2) Get the ICS feeds and merge them and then create a new ICS (create both "import" and "export" folders and give them writing permissions).

require_once('../classes/iCalcreator/iCalcreator.class.php');

$config2 = array("unique_id" => "kigkonsult2.se",
     "directory" => "import",
);
$vcalendar2 = new vcalendar($config2);

$vcalendar2->setConfig("url" , "https://someweb/cal.ics");

$vcalendar2->parse();

$vcalendar2->setConfig("url" , "https://anotherurl/cal2.ics");
$vcalendar2->parse();

$vcalendar2->setConfig("directory", "export");
$vcalendar2->setConfig("filename", "icalmerge3.ics");
$vcalendar2->saveCalendar();


echo "done";

3) Create a CRON scheduler to run this file recurrently. Point both Airbnb and Flipkey to the url where the feed is created. You can use as many input ICS files as you want.



来源:https://stackoverflow.com/questions/27239722/sync-multiple-icalendars-airbnb-flipkey-google-calendar-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!