[horde] import calendar events into kronolith - using xmlRPC?
Michael J Rubinsky
mrubinsk at horde.org
Thu Jan 21 16:04:52 UTC 2016
Quoting Michael J Rubinsky <mrubinsk at horde.org>:
> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Daniel <horde at daniu.de>:
>>
>>> Hi,
>>>
>>> I am new to the list - hope my request is in the right place here:
>>>
>>> My final goal is to get a calendar from google into kronolith.
>>> Unfortunately my provider did not setup kronolith so that I can do
>>> that with kronolith itsself so I think of a cron-job that does
>>> that with a php script (I am not talking about syncing - just
>>> copying the google calendar to kronolith. Since the google
>>> calendar itsself gets populated with a cron-job itsself it's ok to
>>> have accurate data only after copying). I can already read all
>>> appointments from google (caldav still works) - so I got a string
>>> with Vevent infos. The plan is to purge the existing calendar in
>>> kronolith and write all events from the string into the existing
>>> calendar.
>>>
>>> I tried to adjust this: http://theupstairsroom.com/66 but don't
>>> seem to get it working at all. Partly because I don't have access
>>> to horde sources on the server from which I connect to the Horde -
>>> so I need to use another RPC-client. I would like to use the
>>> RPC-client built in php (epinion.com) which is turned on according
>>> to phpinfo. Somehow I cannot really find a good tutorial how to do
>>> that.
>>>
>>> Adjusting a script from php.net gave me the attached attempt. That
>>> one does nothing unfortunately ... (but at least no error message)
>>>
>>> Can someone point me in the right direction? Or is there a simpler
>>> way to achieve what I want to do?
>>>
>>> Is https a problem for what I want to do? Are my adjustments for
>>> that correct?
>>>
>>> Looking at the api it seems like the purge function from import in
>>> the GUI did not make it in there ... any chance to still do it or
>>> get it in the api?
>>>
>>> Thanks for any input!
>>>
>>> (BTW: there is a sourceforge project with exactly that topic, but
>>> it does not work any more and the author did not maintain it - I
>>> even asked him and he says he cannot help -
>>> http://sourceforge.net/projects/kron2gcalsync/)
>>>
>>> ***
>>> function do_call($host, $port, $request) {
>>>
>>> $url = "https://$host:$port/";
>>> //echo $url;
>>> $header[] = "Content-type: text/xml";
>>> $header[] = "Content-length: ".strlen($request);
>>> $to['user']='username';
>>> $to['pass']='password';
>>> $userpwd = $to['user'] .":". $to['pass'];
>>>
>>>
>>> $ch = curl_init();
>>> curl_setopt($ch, CURLOPT_URL, $url);
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>>> curl_setopt($ch, CURLOPT_TIMEOUT, 1);
>>> curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
>>> curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
>>> curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
>>> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
>>> curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
>>>
>>> $data = curl_exec($ch);
>>> if (curl_errno($ch)) {
>>> print curl_error($ch);
>>> } else {
>>> curl_close($ch);
>>> return $data;
>>> }
>>> }
>>>
>>> $host="path/rpc.php";
>>> $port=443;
>>> $request = xmlrpc_encode_request('kronolith.listCalendars', array());
>>> $response = do_call($host, $port, $request);
>>> echo $response;
>>> ***
>>>
>>> regards
>>>
>>> --
>>> Horde mailing list
>>> Frequently Asked Questions: http://horde.org/faq/
>>> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>>
>> You want to use the kronolith-import-icals script that comes with Kronolith.
>
> This is correct, if you have shell access. If you don't, you should
> probably change to JSON as Jan suggests below. In newer versions of
> Horde we no longer support xmlrpc.
>
> Also:
> 1) Don't set the port number in CURL when you use https:// already
> in the URL.
> 2) The proper method name would be "calendar.listCalendars", not
> "kronolith.listCalendars".
>
> So, for example (this is VERY rough and quickly done, so you might
> need to tweak some things):
>
>
> function do_call($host, $method, $params) {
> $url = "https://$host";
> $header[] = "Content-type: application/json";
> $data = array('version' => '1.1', 'method' => $request);
Sorry, this line should be (substitute $method for $request):
$data = array('version' => '1.1', 'method' => $method);
--
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5751 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/horde/attachments/20160121/cda065e2/attachment-0001.bin>
More information about the horde
mailing list