PHP code example of astock / stock-api-libphp
1. Go to this page and download the library: Download astock/stock-api-libphp 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/ */
astock / stock-api-libphp example snippets
$results_columns = Constants::getResultColumns();
$result_column_array = [
$results_columns['NB_RESULTS'],
$results_columns['COUNTRY_NAME'],
$results_columns['ID'],
];
$results_columns = Constants::getResultColumns();
$result_column_array = [
$results_columns['THUMBNAIL_110_URL'],
$results_columns['THUMBNAIL_110_WIDTH'],
$results_columns['THUMBNAIL_110_HEIGHT'],
];
$results_columns = Constants::getResultColumns();
$params = new SearchParamLicenseHistory();
$params->setOffset(0)->setLimit(5);
$result_column_array = [
$results_columns['THUMBNAIL_110_URL'],
$results_columns['THUMBNAIL_110_WIDTH'],
$results_columns['THUMBNAIL_110_HEIGHT'],
];
$request = new LicenseHistoryRequest();
$request->setLocale('En_US');
$request->setSearchParams($params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('LucaTest1', 'Spark Page', 'PROD', $http_client);
$response = $this->_adobe_stock_client->initializeLicenseHistory($request, '')->getNextLicenseHistory();
$results_columns = Constants::getResultColumns();
$params = new SearchParamLicenseHistory();
$params->setOffset(0)->setLimit(5);
$result_column_array = [
$results_columns['THUMBNAIL_110_URL'],
$results_columns['THUMBNAIL_110_WIDTH'],
$results_columns['THUMBNAIL_110_HEIGHT'],
];
$request = new LicenseHistoryRequest();
$request->setLocale('En_US');
$request->setSearchParams($params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('LucaTest1', 'Spark Page', 'PROD', $http_client);
$response = $this->_adobe_stock_client->initializeLicenseHistory($request, '')->getPreviousLicenseHistory();
$results_columns = Constants::getResultColumns();
$params = new SearchParamLicenseHistory();
$params->setOffset(0)->setLimit(5);
$result_column_array = [
$results_columns['THUMBNAIL_110_URL'],
$results_columns['THUMBNAIL_110_WIDTH'],
$results_columns['THUMBNAIL_110_HEIGHT'],
];
$request = new LicenseHistoryRequest();
$request->setLocale('En_US');
$request->setSearchParams($params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('LucaTest1', 'Spark Page', 'PROD', $http_client);
$response = $this->_adobe_stock_client->initializeLicenseHistory($request, '')->getLicenseHistoryPage();
PHP
$results_columns = Constants::getResultColumns();
$search_params = new SearchParameters();
$search_params->setWords('tree')->setLimit(3)->setOffset(0);
$result_column_array = [
$results_columns['NB_RESULTS'],
$results_columns['COUNTRY_NAME'],
$results_columns['ID'],
];
$request = new SearchFilesRequest();
$request->setLocale('En_US');
$request->setSearchParams($search_params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$response = $this->_adobe_stock_client->searchFilesInitialize($request, '');
PHP
$results_columns = Constants::getResultColumns();
$search_params = new SearchParameters();
$search_params->setWords('tree')->setLimit(3)->setOffset(0);
$result_column_array = [
$results_columns['NB_RESULTS'],
$results_columns['COUNTRY_NAME'],
$results_columns['ID'],
];
$request = new SearchFilesRequest();
$request->setLocale('En_US');
$request->setSearchParams($search_params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$search_files_response = $this->_adobe_stock_client->searchFilesInitialize($request, '')->getNextResponse();
PHP
$results_columns = Constants::getResultColumns();
$search_params = new SearchParameters();
$search_params->setWords('tree')->setLimit(3)->setOffset(0);
$result_column_array = [
$results_columns['NB_RESULTS'],
$results_columns['COUNTRY_NAME'],
$results_columns['ID'],
];
$request = new SearchFilesRequest();
$request->setLocale('En_US');
$request->setSearchParams($search_params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$search_files_response = $this->_adobe_stock_client->searchFilesInitialize($request, '')->getPreviousResponse();
PHP
$results_columns = Constants::getResultColumns();
$search_params = new SearchParameters();
$search_params->setWords('tree')->setLimit(3)->setOffset(0);
$result_column_array = [
$results_columns['NB_RESULTS'],
$results_columns['COUNTRY_NAME'],
$results_columns['ID'],
];
$request = new SearchFilesRequest();
$request->setLocale('En_US');
$request->setSearchParams($search_params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$search_files_response = $this->_adobe_stock_client->searchFilesInitialize($request, '')->getResponsePage(10);
PHP
$request = new LicenseRequest();
$request->setLocale('En_US');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$license_response = $this->_adobe_stock_client->getContentInfo($request, '');
PHP
$request = new LicenseRequest();
$request->setLocale('En_US');
$request->setContentId(84071201);
$array = [[
'id' => 1,
'value' => 'test',
]];
$request->setLicenseReference($array);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$license_response = $this->_adobe_stock_client->getContentLicense($request, '');
PHP
$request = new LicenseRequest();
$request->setLocale('En_US');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$license_response = $this->_adobe_stock_client->getMemberProfile($request, '');
PHP
$request = new LicenseRequest();
$request->setLocale('En_US');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$license_response = $this->_adobe_stock_client->abandonLicense($request, '');
PHP
$request = new LicenseRequest();
$request->setLicenseState('STANDARD');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$guzzle_request = $this->_adobe_stock_client->downloadAssetRequest($request, '');
PHP
$request = new LicenseRequest();
$request->setLicenseState('STANDARD');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$url = $this->_adobe_stock_client->downloadAssetUrl($request, '');
PHP
$request = new LicenseRequest();
$request->setLicenseState('STANDARD');
$request->setContentId(84071201);
$this->_adobe_stock_client = new AdobeStock('AdobeStockClient1', 'Adobe Stock Lib/1.0.0', 'PROD', $http_client);
$image_stream = $this->_adobe_stock_client->downloadAssetStream($request, '');
PHP
$results_columns = Constants::getResultColumns();
$params = new SearchParamLicenseHistory();
$params->setOffset(0)->setLimit(5);
$result_column_array = [
$results_columns['THUMBNAIL_110_URL'],
$results_columns['THUMBNAIL_110_WIDTH'],
$results_columns['THUMBNAIL_110_HEIGHT'],
];
$request = new LicenseHistoryRequest();
$request->setLocale('En_US');
$request->setSearchParams($params);
$request->setResultColumns($result_column_array);
$this->_adobe_stock_client = new AdobeStock('LucaTest1', 'Spark Page', 'PROD', $http_client);
$response = $this->_adobe_stock_client->initializeLicenseHistory($request, '');