67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
|
<?php
|
|||
|
require_once(realpath(dirname(__FILE__) . '/../') . '/phpmailer/class.phpmailer.php');
|
|||
|
|
|||
|
define('ERROR_MESSAGE', 'Une erreur est survenue lors de votre requ<71>te.');
|
|||
|
|
|||
|
/*
|
|||
|
* Gestion des erreurs SOAP
|
|||
|
*
|
|||
|
*/
|
|||
|
function processSoapFault($lastRequest, $lastResponse, $fault, $debug = FALSE){
|
|||
|
$message = 'Request : '. htmlspecialchars($lastRequest) . '<br/>' .
|
|||
|
'Response : '. htmlspecialchars($lastResponse) . '<br/>';
|
|||
|
|
|||
|
foreach ($fault as $key => $value){ $message .= $key .' : '. $value . '<br/>';}
|
|||
|
|
|||
|
if($debug == TRUE){
|
|||
|
print '<pre>';
|
|||
|
print $message;
|
|||
|
print '</pre>';
|
|||
|
}else{
|
|||
|
//mailSoapFault($message);
|
|||
|
return messageSoapFault();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
* Affiche un message d'erreur sympatique au visiteur
|
|||
|
*
|
|||
|
*/
|
|||
|
function messageSoapFault(){
|
|||
|
(defined('ERROR_MESSAGE')) ? ($message = ERROR_MESSAGE) : ($message = "Une erreur est survenue lors de votre requ<71>te") ;
|
|||
|
return $message;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
* Envoi de l'erreur Soap par mail
|
|||
|
*
|
|||
|
*/
|
|||
|
function mailSoapFault($message){
|
|||
|
$mail = new PHPMailer();
|
|||
|
$body = $message;
|
|||
|
$body = eregi_replace("[\]",'',$body);
|
|||
|
$mail->From = "contact@scores-decisions.com";
|
|||
|
$mail->FromName = "Serveur SD-13408";
|
|||
|
$mail->Subject = "Erreur SOAP (Date :".date("d")."/".date("m")."/".date("d").")";
|
|||
|
$mail->MsgHTML($body);
|
|||
|
$mail->AddAddress("support@scores-decisions.com", "Support");
|
|||
|
if(!$mail->Send()) {
|
|||
|
logSoapFault($message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
* Fonction qui enregistre les messages d'erreur dans un log
|
|||
|
*
|
|||
|
*/
|
|||
|
|
|||
|
function logSoapFault($message){
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
?>
|