u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
439 stars 144 forks source link

iCal from outlook is not working #319

Closed djschilling closed 1 year ago

djschilling commented 1 year ago

When using the iCal Url from outlook the library cannot find the resource. ICal URL: https://outlook.office365.com/owa/calendar/fdb68ce824734d6d9baf8e449812a815@mbgoe.de/d5a7fe4544fc46fb9cc0e734c75301d514870221531791695719/calendar.ics

This is the error i get using it:

Warning: file(https://...@mbgoe.de/d5a7fe4544fc46fb9cc0e734c75301d514870221531791695719/calendar.ics): Failed to open stream: HTTP request failed! HTTP/1.1 400 in /Users/david/projects/churchtools/system/composer/johngrogg/ics-parser/src/ICal/ICal.php on line 2639

I debugged it and this is the code that fails:

Bildschirmfoto 2023-03-30 um 16 09 41

I think the file Method cannot deal with the url that has the @ sign in the middle. Putting the URL in Chrome returns the iCal File and also Apple Kalender can use this iCal URL.

Maybe another way to fetch http URLs is necessary here.

u01jmg3 commented 1 year ago

Feel free to submit a PR

u01jmg3 commented 1 year ago

Did you see this in the README?

https://github.com/u01jmg3/ics-parser#are-you-using-outlook

This works:

$ical = new ICal(
    'https://outlook.office365.com/owa/calendar/fdb68ce824734d6d9baf8e449812a815@mbgoe.de/d5a7fe4544fc46fb9cc0e734c75301d514870221531791695719/calendar.ics', 
    array('httpUserAgent' => 'A User Agent')
);

Also see previously closed issues: https://github.com/u01jmg3/ics-parser/issues?q=is%3Aissue+outlook.office365.com

djschilling commented 1 year ago

thanks for the answer. would be nice to get this answer before requesting to make a pull request.

u01jmg3 commented 1 year ago

Indeed but I work a full-time job and don't always have the time to explore the intricacies of every issue that's raised. If you think there's a bug with a piece of open source software I would always encourage someone to look at raising a pull request (rather than raising an issue and stopping there). It's also within your power to read all available documentation and to comb through previously closed issues in case your issue has been raised/solved before.

If anything, you learned a little about this library and are better placed to contribute in the future.