smarcet / caldavclient Goto Github PK
View Code? Open in Web Editor NEWSimple CALDAV client for PHP, tested with iCloud
Simple CALDAV client for PHP, tested with iCloud
Hi there,
You're package has sabre/uri at 1.2
and sabre/xml at 1.5
.
Is there a reason why? For both there is a way newer 2.x release.
As my project uses sabre/dav at ^4.0.3
which requires sabre/xml at ^2.1
and
sabre/vobject at ^4.3.0
which requires sabre/xml at ^2.1
im not able to use this awesome package.
Hi any documentation on how to connect to a remote CalDAV server?
any code sample?
Hi there
I am currently trying to get events from iCloud to my application. Since some month I am having issues getting the calendars from iCloud (maybe they changed something on their side). So I wanted to try out this lib. However, it seems to be failing on the same code:
self::$client = new CalDavClient(
'https://p56-caldav.icloud.com/',
'[email protected]',
'yxxx-xxxx-xxxx-xxxx'
);
// this is true
$valid = self::$client->isValidServer();
// get principal returns a valid url
$res = self::$client->getUserPrincipal();
$principal_url = $res->getPrincipalUrl();
// here it fails:
$calendar_home = self::$client->getCalendarHome($principal_url);
A NotFoundResourceException
is thrown. Are you guys able to get your calendar home? Any idea why it does not work for me? (tried a dozen of iCloud accounts now).
Thank you very much for your support on my last issue. I am now trying to receive events from a calendar, but it always results in an error. Here is my code:
$res = self::$client->getUserPrincipal();
$principal_url = $res->getPrincipalUrl();
$calendar_home = self::$client->getCalendarHome($principal_url);
$calendar_home_url = $calendar_home->getCalendarHomeSetUrl();
$start = new \DateTime('-1 week');
$end = new \DateTime('+ 1 week');
$filter = new CalendarQueryFilter(true, false, $start, $end);
// this produces this url: https://p56-caldav.icloud.com/2xxxxx427/calendars/F398F1E6-xxxx-4BEF-A15D-BBF5B5BB8537
$events = self::$client->getEventsByQuery($calendar_home_url . self::$calendar_id, $filter);
Error:
GuzzleHttp/Exception/ServerException
Server error: `REPORT https://p56-caldav.icloud.com/2xxxxx427/calendars/F398F1E6-xxxx-4BEF-A15D-BBF5B5BB8537` resulted in a `500 Internal Server Error` response
Am I doing something wrong here? The client is correctly initialized and valid.
Thank you very much for your support, I will give something back to you once this works.
Hi @smarcet
We are experiencing some issues since some days with iCloud. Whenever we try to authenticate a user with the following code, an exception is thrown. It was working before and we didn't change anything. Maybe Apple did?
public static function auth($username, $password, $user_id, $calendar_id) {
self::$client = null;
self::$nearestServer = null;
self::$client = new CalDavClient(
'https://p01-caldav.icloud.com:443',
$username,
$password
);
self::$calendarId = $calendar_id;
self::$calendarHome = self::getCalendarHome();
return self::$client->isValidServer();
}
Throws this error:
CalDAVClient\Facade\Exceptions\UserUnAuthorizedException: in /Applications/MAMP/htdocs/calenso/vendor/smarcet/caldavclient/src/Facade/CalDavClient.php on line 182
Do you have any idea why this could happen? We are using the app-specific-passwords that can be generated by Apple.
Thanks for your feedback.
Cheers
Patrick
Hey there
We updated the lib from 1.1.2 to 1.1.6, now our function for getting UserPrincipal and PrincipalUrl fails. The UserUnAuthorizedException gets thrown in CalDavClient.php ond the function getUserPrincipal().
Can someone tell us what changed in this request for getting getUserPrincipal and getPrincipalUrl
public static function getCalendarHome() {
$res = self::$client->getUserPrincipal();
$principal_url = $res->getPrincipalUrl();
$calendar_home = self::$client->getCalendarHome($principal_url);
self::$nearestServer = $calendar_home->getRealCalDAVHost();
return $calendar_home->getCalendarHomeSetUrl();
}
Error-Message in stack: Error: Call to undefined method CalDAVClient\Facade\Responses\UserPrincipalResponse::getPrincipalUrl()
Thanks in advance
Marvin
unit tests need a refactoring, bc they can run individually code its making assumption that run from start to end.
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.