getSharedObject.php 897 Bytes
<?php

require_once 'config.php';

$parameters = array();

$type = (isset($_GET['type'])) ? $_GET['type'] : "catalog";
$id = (isset($_GET['id'])) ? $_GET['id'] : exit;

$url = ($type == "catalog") ? webAlias.'/php/rest/getCatalog.php' :  webAlias.'/php/rest/getTimeTable.php' ;
if($type == "catalog")
    $parameters["catID"] = $id;
else
    $parameters["ttID"] = $id;

$parameters["outputFormat"] = (isset($_GET['format'])) ? $_GET['format'] : "ASCII";

$nameToGive = (isset($_GET['nameToGive'])) ? $_GET['nameToGive'] : $type;
$nameToGive .= ($parameters["outputFormat"] == "VOTable") ? ".xml":".txt";


$url .= "?".http_build_query($parameters);
$fileUrl =  str_replace("\n", '',file_get_contents($url));

// headers to send your file
header("Content-Type: text/plain");
header('Content-Disposition: inline; filename="' . $nameToGive . '"');

ob_clean();
flush();
readfile($fileUrl);
exit;

?>