b7c7a5f6
Alexey Boroda
first commit
|
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
|
<?php
namespace App\Traits;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
trait SiteApi
{
protected static function getRemote($url, $data = array())
{
$base = 'https://akaunting.com/api/';
$client = new Client(['verify' => false, 'base_uri' => $base]);
$headers['headers'] = array(
'Authorization' => 'Bearer ' . setting('general.api_token'),
'Accept' => 'application/json',
'Referer' => env('APP_URL'),
'Akaunting' => version('short')
);
$data['http_errors'] = false;
$data = array_merge($data, $headers);
try {
$result = $client->get($url, $data);
} catch (RequestException $e) {
$result = $e;
}
return $result;
}
}
|