34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
// include_once __DIR__.'/../../config/config.inc.php';
|
|
|
|
use Mirakl\MMP\Shop\Client\ShopApiClient;
|
|
use Mirakl\MMP\Shop\Request\Offer\GetOfferRequest;
|
|
|
|
include_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
|
|
$client = new \Empik\Marketplace\API\EmpikClient(111, 222);
|
|
|
|
$url = 'https://stg1.marketplace.empik.com/';
|
|
$apiKey = 'Waynet123!Waynet';
|
|
|
|
try {
|
|
// Instantiating the Mirakl API Client
|
|
$api = new ShopApiClient($url, $apiKey);
|
|
|
|
// Building request
|
|
$request = new GetOfferRequest('OFFER_ID');
|
|
|
|
// Calling the API
|
|
$result = $api->getOffer($request);
|
|
var_dump($result); // \Mirakl\MMP\Shop\Domain\Offer\ShopOffer
|
|
|
|
// You can also retrieve raw response by using run() method of API client:
|
|
// $result = $api->run($request); // or $api->raw()->getOffer($request)
|
|
// var_dump($result); // returns \Psr\Http\Message\ResponseInterface
|
|
|
|
} catch (\Exception $e) {
|
|
// An exception is thrown if object requested is not found or if an error occurs
|
|
var_dump($e->getMessage());
|
|
} |