forked from GhazanfarMir/laravel-companies-house
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
45 lines (29 loc) · 1.34 KB
/
index.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
<?php
use GhazanfarMir\CompaniesHouse\CompaniesHouse;
use GhazanfarMir\CompaniesHouse\Http\Client;
include 'vendor/autoload.php';
define('NEWLINE', php_sapi_name() === 'cli' ? PHP_EOL : '<br>');
try {
$base_uri = 'https://api.companieshouse.gov.uk/';
$api_key = 'IvSp6uE13FPbE8iDPx6Yey9aQ64jH3Cvm18eAE_N';
$client = new Client($base_uri, $api_key);
$api = new CompaniesHouse($client);
$company = 'Ebury Partners';
// search resources
$all = $api->search()->all($company);
print_r('Search all: ' . $all->items[0]->title . NEWLINE);
$companies = $api->search()->companies('Ebury Partners');
print_r('Search Companies: ' . $companies->items[0]->title . NEWLINE);
$officers = $api->search()->officers('Mir');
print_r('Search Officers: ' . $officers->items[0]->title . NEWLINE);
$disqualified_officers = $api->search()->disqualified_officers('Mir');
print_r('Search Disqualified Officers: ' . $disqualified_officers->items[0]->title . NEWLINE);
// Companies resources
$company = $api->company('07086058')->get();
print_r('Search Company byNumber: ' . $company->company_name . NEWLINE);
// Search Officers
$officers = $api->company('07086058')->officers();
print_r('Company Officers: ' . $officers->items[0]->name . NEWLINE);
} catch (Exception $e) {
echo $e->getMessage();
}