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.