dongyi1429 2017-06-03 02:00
浏览 253

cURL Apple iCloud日历订阅链接失败

I've been using cURL in a php web application to fetch ics data from iCloud calendars, but recently it has stopped working. The JSON response is {"reason":"Invalid or missing Origin header","error":1} The link provided by iCloud has the webcal:// protocol, but it has worked in the past to replace it with https://.

Here's the cURL request in PHP:

$request = curl_init();
curl_setopt_array($request, array
    (
    CURLOPT_URL => 'https://p05-calendarws.icloud.com/ca/subscribe/1/D_qOGO6JavMSf055UDaLZJP3SMdywBrlw_w6JkYC1yNJK6R5oxtSOXXXXXXXXXX',
    CURLOPT_POST => FALSE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HEADER => FALSE,
    CURLOPT_FOLLOWLOCATION => TRUE
));

$response = curl_exec($request);
curl_close($request);

I think it might be a problem with Apple and their 2 factor authentication that they've been promoting lately. If this is the cause, I found where to get an app-specific password from iCloud, but not sure how to implement that here.

  • 写回答

1条回答 默认 最新

  • drg14799 2017-09-19 01:33
    关注

    Probably too late to help, but this might only work for published (sharable, read-only) calendars. I tried it with one of mine (and echo'd the $response) and got all the events for my calendar.

    CURLOPT_URL => 'https://p35-calendars.icloud.com/published/2/f3en8ZL-G5cgxxxxxxxxx'
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog