* Copyright (C) 2003 - 2007 phpScheduleIt * License: GPL, see LICENSE */ require_once '../lib/pagebase/download/StreamDownload.php'; require_once '../lib/icalendar/ICalExport.php'; require_once '../lib/icalendar/ICalReservationFormatter.php'; require_once '../lib/vcalendar/VCalExport.php'; require_once '../lib/vcalendar/VCalReservationFormatter.php'; require_once '../lib/ReservationSearch.php'; require_once '../lib/Auth.class.php'; define('ICAL', 'ical'); define('VCAL', 'vcal'); if (!Auth::is_logged_in()) { CmnFns::redirect('../ctrlpnl.php', 1, false); } $export = getExport(); $ext = getExtension(); $page = new StreamDownload("phpScheduleIt.{$ext}", $export->toString()); $page->download(); function getExport() { $results = getResults(); if (isset($_GET['type']) && $_GET['type'] == VCAL) { return new VCalExport($results); } else { return new ICalExport($results); } } function getExtension() { if (isset($_GET['type']) && $_GET['type'] == VCAL) {
<?php error_reporting(E_ALL); ini_set("display_errors", 1); getExport(); function getExport() { $exportkey = "ed576f23-2843-4e36-92d0-dd9f7c36b7d0"; $key = base64_encode("XC6ADpiwSw9IiW4y40ziLD34oXkVY0geb66IB-56nC8"); $target_url = "https://api.itscope.com/1.0/products/exports/" . $exportkey; print_r($target_url); // header('Authorization: Basic'.trim($key)); // // copy($target_url, "export/test.zip"); $header = array('Authorization: Basic' . trim($key)); //$header = array('User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Connection: keep-alive', 'Accept-Encoding: gzip, deflate','Authorization: Basic'.trim($key)); // $fp = fopen("export/test.zip","a"); $zip = new ZipArchive(); $res = $zip->open('export/test.zip', ZIPARCHIVE::CREATE); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $target_url); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //curl_setopt($ch, CURLOPT_POST,0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FILE, $zip->addFile()); curl_setopt($ch, CURLOPT_TIMEOUT, 360); $result = curl_exec($ch); $error = curl_error($ch); print '<pre>'; print_r($error); print '</pre>';