1. Go to this page and download the library: Download pllano/api 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/ */
pllano / api example snippets
php
equire_once __DIR__.'/Api.php';
$action = 'price'; // Название модели к которой мы обращаемся
$metod = 'curl'; // get = file_get_contents или curl
$id = null; // Уникальный индефикатор item. Если null выводим список.
$public_key = 'test'; // Публичный ключ авторизации. По умолчанию test для настройки API
$query = null; // Дублируем тип запроса. Имеет приоритет выше чем в самом запросе.
$order = null; // Сотрировка asc|desc По умолчанию asc
$sort = null; // Поле по которому сортируем. По умолчанию id
$offset = null; // Смещение. Начать с указанной страницы. По умолчанию 0
$limit = null; // Лимит вывода записей на страницу. По умолчанию 10
//Массив для GET запроса
$getArray = array(
"public_key" => $public_key,
"query" => $query,
"order" => $order,
"sort" => $sort,
"offset" => $offset,
"limit" => $limit
);
$api = new Pllano\Api('ua');
$records = $api->get($getArray, $action, $metod, $id);
if (isset($records['header']['code'])) {
if ($records['header']['code'] == '200') {
$count = count($records['price']['items']);
if ($count >= 1) {
foreach($records['price']['items'] as $item)
{
print_r($item['item']['id']);
}
}
}
}
php
GuzzleHttp\Client as Guzzle;
// Подключаем Guzzle
$client = new Guzzle();
// Отправляем запрос
$response = $client->request('GET', 'https://ua.pllano.com/api/v1/json/price/?public_key=test');
// Получаем тело ответа
$output = $response->getBody();
$records = json_encode(json_decode($output, true), JSON_PRETTY_PRINT);
// Вывести на экран json
print_r($records);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.