PHP code example of plhw / hf-api-client
1. Go to this page and download the library: Download plhw/hf-api-client library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
plhw / hf-api-client example snippets
$options = \HF\ApiClient\Options\Options::fromArray(
[
'server_uri' => 'https://api.plhw.nl',
'client_id' => 'id',
'client_secret' => 'secret',
'scope' => 'customer_pos',
'grant_type' => 'client_credentials',
]
);
$api = \HF\ApiClient\ApiClient::createClient($options, /* $cache OPTIONAL */);
$results = $api->customer_posAroundCoordinate('52.3629882,4.8593175', 15000, 'insoles');
if ($api->isSuccess()) {
foreach ($results['data'] as $result) {
printf("Practice %s on %skm\n", $result['attributes']['name'],
round(($result['attributes']['distance'] / 100)) / 10);
printf(" - sells %s\n", implode(', ', $result['attributes']['products']));
}
} else {
printf("Error (%d): %s\n", $api->getStatusCode(), $result);
}
bash
cp ./vendor/plhw/hf-api-client/example/.hf-api-client-secrets.php.dist ./.hf-api-client-secrets.php
bash
php ./vendor/plhw/hf-api-client/example/practicesPos.php