1. Go to this page and download the library: Download gam6itko/ozon-seller 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/ */
gam6itko / ozon-seller example snippets
use Gam6itko\OzonSeller\Service\V1\ProductService;
use Symfony\Component\HttpClient\Psr18Client;
$config = [$_SERVER['CLIENT_ID'], $_SERVER['API_KEY'], $_SERVER['API_URL']];
$client = new Psr18Client();
$svc = new ProductService($config, $client);
//do stuff
use Gam6itko\OzonSeller\Service\V1\CategoriesService;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
use Http\Factory\Guzzle\RequestFactory;
use Http\Factory\Guzzle\StreamFactory;
$config = [
'clientId' => '<ozon seller client-id>',
'apiKey' => '<ozon seller api-key>',
'host' => 'http://cb-api.ozonru.me/'
];
$client = new GuzzleAdapter(new GuzzleClient());
$requestFactory = new RequestFactory();
$streamFactory = new StreamFactory();
$svc = new CategoriesService($config, $client, $requestFactory, $streamFactory);
//do stuff
use Gam6itko\OzonSeller\Service\V1\CategoriesService;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
$config = [
'clientId' => '<ozon seller client-id>',
'apiKey' => '<ozon seller api-key>',
'host' => 'http://cb-api.ozonru.me/' //sandbox
];
$adapter = new GuzzleAdapter(new GuzzleClient());
$svc = new CategoriesService($config, $adapter);
//Server Response example: https://cb-api.ozonru.me/apiref/en/#t-title_categories
$categoryTree = $svc->tree();
//Server Response example: https://cb-api.ozonru.me/apiref/en/#t-title_get_categories_attributes
$attributes = $svc->attributes(17038826);
use Gam6itko\OzonSeller\Service\V2\Posting\CrossborderService;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
$config = [
'clientId' => '<ozon seller client-id>',
'apiKey' => '<ozon seller api-key>',
'host' => 'http://cb-api.ozonru.me/'
];
$adapter = new GuzzleAdapter(new GuzzleClient());
$svc = new CrossborderService($config, $adapter);
$postingNumber = '39268230-0002-3';
$orderArr = $svc->get($postingNumber);
echo json_encode($orderArr);