8847079109
Intégration include_path (prepend.php)
59 lines
1.8 KiB
PHP
59 lines
1.8 KiB
PHP
<?php
|
|
include_once(FWK_PATH.'/common/curl.php');
|
|
if (!$_SESSION['connected'])
|
|
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
|
else
|
|
{
|
|
|
|
$client = new SoapClient(null, array( 'trace' => 1,
|
|
'soap_version' => SOAP_1_1,
|
|
'location' => WEBSERVICE_URL,
|
|
'uri' => WEBSERVICE_URI,
|
|
'login' => $_SESSION['tabInfo']['login'],
|
|
'password' => $_SESSION['tabInfo']['password'],
|
|
// 'encoding' => 'UTF-8'
|
|
));
|
|
|
|
if (isset($_REQUEST['nomFic'])) $nomFic = $_REQUEST['nomFic'];
|
|
else $nomFic = '';
|
|
try {
|
|
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
|
|
$file=realpath(dirname(__FILE__) . '/../pdf/').$nomFic;
|
|
$file2 = $file.'.bz2';
|
|
if (!file_exists($file)) {
|
|
$page=getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
|
$body=$page['body'];
|
|
$fp=@fopen($file2, 'w');
|
|
@fwrite($fp, $body);
|
|
@fclose($fp);
|
|
|
|
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
|
$fp=@fopen($file, 'w');
|
|
while (!feof($bz)) {
|
|
@fwrite($fp, bzread($bz, 4096));
|
|
}
|
|
bzclose($bz);
|
|
}
|
|
} catch (SoapFault $fault) {
|
|
//$message='Erreur SOAP lors de la mise à jour !';
|
|
//echo '<pre>'.$client->__getLastResponse().'</pre>';
|
|
echo 'ERREUR SOAP :'.EOL;
|
|
print_r($fault);
|
|
}
|
|
|
|
$filename=basename($file);
|
|
$body=file_get_contents($file);
|
|
|
|
header("Pragma: public");
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
header("Cache-Control: must-revalidate");
|
|
header("Content-type: application/csv");
|
|
header("Content-Length: ".strlen($body));
|
|
header('Content-disposition: inline; filename="'.$filename.'"');// attachement or inline
|
|
header("Accept-Ranges: ".strlen($body));
|
|
|
|
echo $body;
|
|
|
|
}
|
|
?>
|