importing ical to my web site as I get a 403 error

Elizabeth123
Level 1
Aberlour, United Kingdom

importing ical to my web site as I get a 403 error

 
6 Replies 6
Chris389
Level 1
Eindhoven, Netherlands

It's a technical issue.

 

AirBNB doesn't reply with a propper response when the iCal is requested by a website instead of a browser. If you fetch the iCal data with file_get_contents($url), you get a 403 error. But if it's requested with curl and you set the user agent it gives a propper response.

 

In PHP this is a working sample:

 

<?php

$ch = curl_init();
// set your iCal url
curl_setopt($ch, CURLOPT_URL, "https://www.airbnb.nl/calendar/ical/xxxxxxx.ics?s=xxxxxx");

//return the transfer as a string, here I fake the user agent, AirBNB thinks it's a request from Firefox / mozilla
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');

// $output contains the output string
$output = curl_exec($ch);

// close curl resource to free up system resources
curl_close($ch);

echo $output;

?>

 

Where do we place the code you provided to make this work in a website?

Dang. I know this is an old-ish thread, but this answer should be somewhere on StackExchange! 😉

 

It's true that -- quite arbitrarily -- performing a GET on an Airbnb icalendar URL will often return a 403 error, but one never sees that behavior in the browser.

 

So yeah it seems one has to set User-Agent header to be something browser-like to ensure you always get a response.

Daljit0
Level 5
Windsor, United Kingdom

I ahve the same issue. Tyrying to liunk the Ical (ics) URL link from AirBNB into Angualr 6 App. Tried all manner of HTTP Get to the URL . Funny think is postman and typeing url in browser works fine. Wondering of AiRBN are using CORS to block the calls from JSON API Calls?!

RaJesh36
Level 1
Sahibzada Ajit Singh Nagar, India

Hi Daljit,

 

Have you resolved this ?

 

 

It is a Closed API. You have to ask God if you can become an AirBNB a worthy partner. If you get partnership it opes doors to get thr API Documentation and OAUTH AUTHORIZION from AirBNB to access the services their API provides. Remember you access their API via HTTPS.