PHP code example of v3toys / yii2-v3project-api
1. Go to this page and download the library: Download v3toys/yii2-v3project-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/ */
v3toys / yii2-v3project-api example snippets
//App config
[
'components' =>
[
//....
'v3projectApi' =>
[
'class' => 'v3toys\v3project\api\Api',
'affiliate_key' => 'fff',
'timeout' => 12,
],
//....
]
]
$response = \Yii::$app->v3projectApi->send('/product/find', [
'filters' =>
[
'v3p_product_ids' => [186893]
]
]);
or
$response = \Yii::$app->v3projectApi->productFind([
'filters' =>
[
'v3p_product_ids' => [186893]
],
'params' =>
[
'format' => 'full'
]
]);
print_r($response->httpClientRequest->url); //Full api url
print_r($response->httpClientRequest->data); //Request data
print_r($response->httpClientRequest->method); //Request method
print_r($response->httpClientRequest->headers); //Request headers
print_r($response->httpClientResponse->statusCode); //Server response code
print_r($response->httpClientResponse->content); //Original api response
if ($response->isError)
{
print_r($response->errorMessage); //Расшифровка кода
print_r($response->errorData);
print_r($response->errorCode);
} else
{
print_r($response->data); //Array response data
}
php composer.phar