-
Notifications
You must be signed in to change notification settings - Fork 21
/
uploadLogoEmpresa.php
46 lines (39 loc) · 1.16 KB
/
uploadLogoEmpresa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
header('Content-Type: text/html; charset=utf-8');
require('../src/eNotasGW.php');
use eNotasGW\Api\Exceptions as Exceptions;
use eNotasGW\Api\fileParameter as fileParameter;
eNotasGW::configure(array(
'apiKey' => '{api key}',
));
$empresaId = '{empresa id}';
try
{
$file = fileParameter::fromPath('{logo image path}',
'image/png', 'logo.png');
eNotasGW::$EmpresaApi->atualizarLogo($empresaId, $file);
echo 'Logo atualizada com sucesso!';
}
catch(Exceptions\invalidApiKeyException $ex) {
echo 'Erro de autenticação: </br></br>';
echo $ex->getMessage();
}
catch(Exceptions\unauthorizedException $ex) {
echo 'Acesso negado: </br></br>';
echo $ex->getMessage();
}
catch(Exceptions\apiException $ex) {
echo 'Erro de validação: </br></br>';
echo $ex->getMessage();
}
catch(Exceptions\requestException $ex) {
echo 'Erro na requisição web: </br></br>';
echo 'Requested url: ' . $ex->requestedUrl;
echo '</br>';
echo 'Response Code: ' . $ex->getCode();
echo '</br>';
echo 'Message: ' . $ex->getMessage();
echo '</br>';
echo 'Response Body: ' . $ex->responseBody;
}
?>