diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..53cac3b
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,4 @@
+
+RewriteEngine on
+RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
+
\ No newline at end of file
diff --git a/ics.php b/ics.php
index 5b930aa..fd03a78 100644
--- a/ics.php
+++ b/ics.php
@@ -1,32 +1,46 @@
-
-
+Access denied.');
+ }
+
+ // Get ics file
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_USERPWD, $user . ':' . $password);
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ $result = curl_exec($curl);
+
+ if (!$result)
+ {
+ die('Error while getting ics file from caldav server.