AltiScore : Meilleure gestion des erreurs

This commit is contained in:
Michael RICOIS 2015-06-17 15:54:46 +00:00
parent 8e434a509c
commit d171491909

View File

@ -88,17 +88,26 @@ if ( $opts->get ) {
}
}
require_once 'Scores/WsScores.php';
foreach ($logins as $login => $hash ) {
echo date('Y-m-dTH:i:s') . " - Login : " . $login;
$ws = new WsScores($login, $hash);
try {
$ws = new WsScores($login, $hash);
} catch(Exception $e) {
echo " - Erreur ".$e->getMessage()."\n";
continue;
}
//Faire la demande du protefeuille en CSV,
$response = $ws->getPortefeuilleCsv($login);
try {
$response = $ws->getPortefeuilleCsv($login);
} catch(Exception $e) {
echo " - Erreur ".$e->getMessage()."\n";
continue;
}
if ( $response !== false ) {
@ -117,7 +126,7 @@ foreach ($logins as $login => $hash ) {
$client = new Zend_Http_Client($url);
$client->setStream();
$response = $client->request('GET');
if ( copy($response->getStreamName(), $path . DIRECTORY_SEPARATOR . $file) ) {
if ( copy($response->getStreamName(), $path . '/' . $file) ) {
echo " - Fichier créer.";
}
} catch (Zend_Http_Client_Exception $e) {