PHP code example of hitmeister / api-sdk

1. Go to this page and download the library: Download hitmeister/api-sdk 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/ */

    

hitmeister / api-sdk example snippets




use Hitmeister\Component\Api\ClientBuilder;

$client = ClientBuilder::create()
	->setClientKey('YOUR_CLIENT_KEY')
	->setClientSecret('YOUR_CLIENT_SECRET')
	->setUserAgent('YOUR_USER_AGENT')
	->build();

$categories = $client->categories()->find('handy');
foreach ($categories as $category) {
	echo "Category ID: {$category->id_category}\n";
	echo "Category Name: {$category->name}\n";
}

$category = $client->categories()->get(1);
echo "Category ID: {$category->id_category}\n";
echo "Category Name: {$category->name}\n";

$items = $client->items()->find('iphone');
foreach ($items as $item) {
	$eans = implode(',', $item->eans);
	echo "Item ID: {$item->id_item}\n";
	echo "Category ID: {$item->id_category}\n";
	echo "Title: {$item->title}\n";
	echo "EANs: {$eans}\n";
}

$items = $client->items()->findByEan('0885909781652');

// Post the task to import your file. You will have the ID of the task.
$importFileId = $client->importFiles()
	->post('http://www.example.com/my_products.csv', 'PRODUCT_FEED');

// Retrieve the information about your task
$data = $client->importFiles()->get($importFileId);
echo "URL: {$data->uri}\n";
echo "Status: {$data->status}\n";

// $result will be true or false
$result = $client->units()->update(10, ['condition' => 'new']);