All Products
Search
Document Center

Image Search:SDK for PHP

Last Updated:Apr 22, 2024

This topic describes how to use Image Search SDK for PHP and provides sample code.

Note

To know more about Image Search, submit your questions on the pre-sales online consultation page or contact Alibaba Cloud in the DingTalk group (ID 35035130) for technical support.

Methods

Method

Description

Add

Adds an image.

SearchImageByPic

Searches for similar images based on an image.

SearchImageByName

Searches for similar images based on the name of an existing image in the image gallery.

Delete

Removes one or more images.

UpdateImage

Updates an image.

Detail

Queries the information about an instance.

DumpMeta

Creates a task to export metadata.

DumpMetaList

Queries a list of tasks that are used to export metadata.

BatchTask

Creates a batch task.

BatchTaskList

Queries a list of tasks that are used to perform batch operations.

Preparations

Before you install and use an Alibaba Cloud SDK, make sure that you have created an Alibaba Cloud account and obtained the AccessKey pair of the Alibaba Cloud account. For more information, see Obtain an AccessKey pair.

Note

Make sure that PHP 5.5 or later is installed.

Obtain the image of Composer:

https://developer.aliyun.com/composer

Install dependencies

  • Use Composer to obtain Image Search SDK for PHP.

    composer require alibabacloud/imagesearch-20201214
  • Use the composer.json file.

    {
       "require": {
           "alibabacloud/imagesearch-20201214": "^4.0"    
        }
    }

The following sample code shows the dependency-related information:

declare (strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use AlibabaCloud\SDK\ImageSearch\V20201214\ImageSearch;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\AddImageAdvanceRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\SearchImageByPicAdvanceRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\SearchImageByNameRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\DeleteImageRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\UpdateImageRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\DetailRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\DumpMetaRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\DumpMetaListRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\IncreaseInstanceRequest;
use AlibabaCloud\SDK\ImageSearch\V20201214\Models\IncreaseListRequest;
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
use GuzzleHttp\Psr7\Stream;

Add

  • Sample code

    function _addImage()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a Resource Access Management (RAM) user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a virtual private cloud (VPC) endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from Elastic Compute Service (ECS) instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
     
        $client = new ImageSearch($config);
        $request = new AddImageAdvanceRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Required. The ID of the product. The ID can be up to 512 characters in length. 
        // A product ID can correspond to multiple image names. 
        $request->productId = "testPhp";
        // Required. The name of the image. The name can be up to 512 characters in length. 
        // 1. An image is uniquely identified by the values of the productId and picName parameters. 
        // 2. If you add an image whose product ID (productId) and image name (picName) are the same as those of an existing image, the newly added image overwrites the existing image. 
        $request->picName = "testPhp";
        // Optional. The ID of the product category. 
        // 1. Product image search: If a category is specified, the specified category prevails. If no category is specified, the system predicts and selects a category. The category selected by the system is included in the response. 
        // 2. Fabric, trademark, and generic image searches: The category ID is set to 88888888 regardless of whether a category is specified. 
        $request->categoryId = 3;
        // Optional. The user-defined content. The value can be up to 4,096 characters in length. 
        // If you specify this parameter, the response includes this parameter and its value. You can add text such as an image description. 
        $request->customContent = "this is a simple test";
        // Optional. The attribute of the INT type. The attribute can be used to filter images during image searches. If you specify this parameter, the response includes this parameter and its value. 
        // For example, you can set different attributes for images from different sites or different users. This way, users can filter images by attribute and obtain more accurate search results.
        $request->intAttr = 56;
        // Optional. The attribute of the STRING type. The value can be up to 128 characters in length. The attribute can be used to filter images during image searches. If you specify this parameter, the response includes this parameter and its value. 
        $request->strAttr = "test";
        // Optional. Specifies whether to identify the subject in the image. Default value: true. 
        // 1. If you set this parameter to true, the system identifies the subject in the image and searches for images based on the identified subject. The response includes the identification result. 
        // 2. If you set this parameter to false, the system searches for images based on the entire image without subject identification. 
        // 3. For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->crop = true;
        // Optional. The subject area of the image, in the format of x1,x2,y1,y2. Specifically, x1 and y1 specify the upper-left point, and x2 and y2 specify the lower-right point. The specified area cannot cross the boundary of the image. 
        // If you specify the region parameter, the search is conducted based on the value of the region parameter regardless of the value of the crop parameter. 
        // For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->region = "167,467,221,407";
        // The image. The image cannot exceed 4 MB in size. The transmission timeout period cannot exceed 5 seconds. Only the following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WebP, TIFF, and PPM.
        // For product, trademark, and generic image searches, the length and the width of an image must range from 100 pixels to 4,096 pixels.
        // For fabric image search, the length and the width of an image must range from 448 pixels to 4,096 pixels.
        // The image cannot contain rotation properties.
    
        // The following sample code provides an example on how to specify an image URL: 
        // composer require alibabacloud/darabonba-stream
        // use AlibabaCloud\Darabonba\Stream\StreamUtil; 
        // $imageStream = StreamUtil::readFromFilePath("<fileUrl>");  
    
        // The following sample code provides an example on how to upload an image file: 
        $imageStream = new Stream(fopen("<filePath>", 'r+'));
        $request->picContentObject = $imageStream;
        $runtime = new RuntimeOptions();
        $runtime->maxIdleConns = 3;
        $runtime->connectTimeout = 3000;
        $runtime->readTimeout = 3000;
        try {
            $response = $client->addImageAdvance($request, $runtime);
            var_dump($response->toMap());
          } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
        } 
    }
  • Sample response

    {
      ["requestId"]=>
      string(36) "242CB8B7-DD36-42ED-9A76-37915DC7ED81"
      ["success"]=>
      bool(true)
      ["message"]=>
      string(7) "success"
      ["code"]=>
      int(0)
      ["picInfo"]=>
      array(2) {
        ["CategoryId"]=>
        int(0)
        ["Region"]=>
        string(15) "167,477,221,407"
      }
      ["_name":protected]=>
      array(5) {
        ["requestId"]=>
        string(9) "RequestId"
        ["success"]=>
        string(7) "Success"
        ["message"]=>
        string(7) "Message"
        ["code"]=>
        string(4) "Code"
        ["picInfo"]=>
        string(7) "PicInfo"
      }
      ["_required":protected]=>
      array(0) {
      }
    }

SearchImageByPic

  • Sample code

    function _getImageByPic()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new SearchImageByPicAdvanceRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxx";    
        // The image. The image cannot exceed 4 MB in size. The transmission timeout period cannot exceed 5 seconds. Only the following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WebP, TIFF, and PPM.
        // For product, trademark, and generic image searches, the length and the width of an image must range from 100 pixels to 4,096 pixels.
        // For fabric image search, the length and the width of an image must range from 448 pixels to 4,096 pixels.
        // The image cannot contain rotation properties.
    
        // The following sample code provides an example on how to specify an image URL: 
        // composer require alibabacloud/darabonba-stream
        // use AlibabaCloud\Darabonba\Stream\StreamUtil; 
        // $imageStream = StreamUtil::readFromFilePath("<fileUrl>");   
    
        // The following sample code provides an example on how to upload an image file:
        $imageStream = new Stream(fopen("<filePath>", 'r+'));
        $request->picContentObject = $imageStream;   
        // Optional. The ID of the product category. 
        // 1. Product image search: If a category is specified, the specified category prevails. If no category is specified, the system predicts and selects a category. The category selected by the system is included in the response. 
        // 2. Fabric, trademark, and generic image searches: The category ID is set to 88888888 regardless of whether a category is specified. 
        $request->categoryId = 3;
        // 1. If you set this parameter to true, the system identifies the subject in the image and searches for images based on the identified subject. The response includes the identification result. 
        // 2. If you set this parameter to false, the system searches for images based on the entire image without subject identification. 
        // 3. For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->crop = true;
        // Optional. The subject area of the image, in the format of x1,x2,y1,y2. Specifically, x1 and y1 specify the upper-left point, and x2 and y2 specify the lower-right point. The specified area cannot cross the boundary of the image. 
        // If you specify the region parameter, the search is conducted based on the value of the region parameter regardless of the value of the crop parameter. 
        // For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->region = "167,467,221,407";
        // Optional. The filter conditions. int_attr supports the following operators: >, >=, <, <=, and =. str_attr supports the = and != operators. You can set the logical operator between conditions to AND or OR. 
        // Examples:
        // 1. Filter images based on the attribute of the INT type: int_attr>=100.
        // 2. Filter images based on the attribute of the STRING type: str_attr!="value1".
        // 3. Filter images based on the attributes of the INT and STRING types: int_attr=1000 AND str_attr="value1".
        $request->filter = "int_attr=56 AND str_attr =\"test\"";
        $runtime = new RuntimeOptions();
        $runtime->maxIdleConns = 3;
        $runtime->connectTimeout = 3000;
        $runtime->readTimeout = 3000;
        try {
            $response = $client->searchImageByPicAdvance($request, $runtime);
            var_dump($response->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
        } catch (Exception $e) {
        }
    }
  • Sample response

    {
      ["requestId"]=>
      string(36) "453517A3-7D00-476E-A946-8CC3B9DC6FA1"
      ["success"]=>
      bool(true)
      ["code"]=>
      int(0)
      ["msg"]=>
      string(7) "success"
      ["auctions"]=>
      array(5) {
        [0]=>
        array(4) {
          ["CategoryId"]=>
          int(0)
          ["PicName"]=>
          string(7) "vae.jpg"
          ["ProductId"]=>
          string(4) "1000"
          ["SortExprValues"]=>
          string(22) "7.33136443711219e+24;0"
          ["Score"]=>
          float(1)
        }
        [1]=>
        array(4) {
          ["CategoryId"]=>
          int(0)
          ["PicName"]=>
          string(4) "test"
          ["ProductId"]=>
          string(4) "test"
          ["SortExprValues"]=>
          string(22) "7.33136443711219e+24;0"
          ["Score"]=>
          float(1)
        }
      ........
        [4]=>
        array(4) {
          ["CategoryId"]=>
          int(0)
          ["PicName"]=>
          string(4) "test"
          ["ProductId"]=>
          string(4) "1000"
          ["SortExprValues"]=>
          string(22) "7.33136443711219e+24;0"
          ["Score"]=>
          float(1)
        }
      }
      ["head"]=>
      array(3) {
        ["DocsFound"]=>
        int(5)
        ["DocsReturn"]=>
        int(5)
        ["SearchTime"]=>
        int(171)
      }
      ["picInfo"]=>
      array(3) {
        ["CategoryId"]=>
        int(0)
        ["MultiRegion"]=>
          array(1) {
            [0]=>
            array(1) {
              ["Region"]=>
              string(15) "134,705,187,785"
            }
         }
        ["AllCategories"]=>
        array(14) {
          [0]=>
          array(2) {
            ["Id"]=>
            int(0)
            ["Name"]=>
            string(4) "Tops"
          }
      ........
          [13]=>
          array(2) {
            ["Id"]=>
            int(88888888)
            ["Name"]=>
            string(5) "Other"
          }
        }
        ["Region"]=>
        string(15) "167,477,221,407"
      }
      ["_name":protected]=>
      array(7) {
        ["requestId"]=>
        string(9) "RequestId"
        ["success"]=>
        string(7) "Success"
        ["code"]=>
        string(4) "Code"
        ["msg"]=>
        string(3) "Msg"
        ["auctions"]=>
        string(8) "Auctions"
        ["head"]=>
        string(4) "Head"
        ["picInfo"]=>
        string(7) "PicInfo"
      }
      ["_required":protected]=>
      array(0) {
      }
    }

SearchImageByName

  • Sample code

    function _getImageByName()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new SearchImageByNameRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxxx";
        // Required. The ID of the product. The ID can be up to 512 characters in length. 
        // A product ID can correspond to multiple image names. 
        $request->productId = "testPhp";
        // Required. The name of the image. The name can be up to 512 characters in length. 
        // 1. An image is uniquely identified by the values of the productId and picName parameters. 
        // 2. If you add an image whose product ID (productId) and image name (picName) are the same as those of an existing image, the newly added image overwrites the existing image. 
        $request->picName = "testPhp";    
        // Optional. The ID of the product category. 
        // 1. Product image search: If a category is specified, the specified category prevails. If no category is specified, the system predicts and selects a category. The category selected by the system is included in the response. 
        // 2. Fabric, trademark, and generic image searches: The category ID is set to 88888888 regardless of whether a category is specified. 
        $request->categoryId = 3;
        // 1. If you set this parameter to true, the system identifies the subject in the image and searches for images based on the identified subject. The response includes the identification result. 
        // 2. If you set this parameter to false, the system searches for images based on the entire image without subject identification. 
        // 3. For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->crop = true;
        // Optional. The subject area of the image, in the format of x1,x2,y1,y2. Specifically, x1 and y1 specify the upper-left point, and x2 and y2 specify the lower-right point. The specified area cannot cross the boundary of the image. 
        // If you specify the region parameter, the search is conducted based on the value of the region parameter regardless of the value of the crop parameter. 
        // For fabric image search, this parameter does not take effect. The system searches for images based on the entire image. 
        $request->region = "167,467,221,407";
        // Optional. The filter conditions. int_attr supports the following operators: >, >=, <, <=, and =. str_attr supports the = and != operators. You can set the logical operator between conditions to AND or OR. 
        // Examples:
        // 1. Filter images based on the attribute of the INT type: int_attr>=100.
        // 2. Filter images based on the attribute of the STRING type: str_attr!="value1".
        // 3. Filter images based on the attributes of the INT and STRING types: int_attr=1000 AND str_attr="value1".
        $request->filter = "int_attr=56 AND str_attr =\"test\"";
     
        try {
            $response = $client->SearchImageByName($request);
            var_dump($response->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
        } catch (Exception $e) {
        }
    }
  • Sample response

    ["requestId"]=>
      string(36) "9248A5FC-97AB-4A96-8764-C771CF61D9A1"
      ["success"]=>
      bool(true)
      ["code"]=>
      int(0)
      ["msg"]=>
      string(7) "success"
      ["auctions"]=>
      array(5) {
        [0]=>
        array(4) {
          ["CategoryId"]=>
          int(0)
          ["PicName"]=>
          string(7) "vae.jpg"
          ["ProductId"]=>
          string(4) "1000"
          ["SortExprValues"]=>
          string(22) "7.33136443711219e+24;0"
          ["Score"]=>
          float(1)
        }
      ........
        [4]=>
        array(4) {
          ["CategoryId"]=>
          int(0)
          ["PicName"]=>
          string(4) "test"
          ["ProductId"]=>
          string(4) "1000"
          ["SortExprValues"]=>
          string(22) "7.33136443711219e+24;0"
          ["Score"]=>
          float(1)
        }
      }
      ["head"]=>
      array(3) {
        ["DocsFound"]=>
        int(5)
        ["DocsReturn"]=>
        int(5)
        ["SearchTime"]=>
        int(21)
      }
      ["picInfo"]=>
      array(2) {
        ["CategoryId"]=>
        int(0)
        ["MultiRegion"]=>
          array(1) {
            [0]=>
            array(1) {
              ["Region"]=>
              string(15) "134,705,187,785"
            }
        }
        ["AllCategories"]=>
        array(14) {
          [0]=>
          array(2) {
            ["Id"]=>
            int(0)
            ["Name"]=>
            string(4) "Tops"
          }
          ........
          [13]=>
          array(2) {
            ["Id"]=>
            int(88888888)
            ["Name"]=>
            string(5) "Other"
          }
        }
      }
      ["_name":protected]=>
      array(7) {
        ["requestId"]=>
        string(9) "RequestId"
        ["success"]=>
        string(7) "Success"
        ["code"]=>
        string(4) "Code"
        ["msg"]=>
        string(3) "Msg"
        ["auctions"]=>
        string(8) "Auctions"
        ["head"]=>
        string(4) "Head"
        ["picInfo"]=>
        string(7) "PicInfo"
      }
      ["_required":protected]=>
      array(0) {
      }
    }

Delete

  • Sample code

    function _deleteImage()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new DeleteImageRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Required. The name of the image. The name can be up to 512 characters in length. 
        // An image is uniquely identified by the values of the productId and picName parameters. 
        $request->productId = "test";
        // Optional. The name of the image. If you do not specify this parameter, the system removes all the images that are related to the specified product ID. If you specify this parameter, the system removes only the image that is specified by the productId and picName parameters. 
        $request->picName = "test";
          
        try {
            $response = $client->deleteImage($request);
            var_dump($response->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    {
      ["requestId"]=>
      string(36) "052ECD87-933D-4E65-94F7-F0C0947E41A1"
      ["success"]=>
      bool(true)
      ["message"]=>
      string(7) "success"
      ["code"]=>
      int(0)
      ["_name":protected]=>
      array(4) {
        ["requestId"]=>
        string(9) "RequestId"
        ["success"]=>
        string(7) "Success"
        ["message"]=>
        string(7) "Message"
        ["code"]=>
        string(4) "Code"
      }
      ["_required":protected]=>
      array(0) {
      }
    }

UpdateImage

  • Sample code

    function _updateImage()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new UpdateImageRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Required. The ID of the product. The product ID cannot be changed. 
        $request->productId = "1";
        // Required. The name of the image. The image name cannot be changed. 
        $request->picName = "1";
        // Optional. The attribute of the INT type. The attribute can be used to filter images during image searches. If you specify this parameter, the response includes this parameter and its value. 
        $request->intAttr = 10;
        // Optional. The attribute of the STRING type. The value can be up to 128 characters in length. The attribute can be used to filter images during image searches. If you specify this parameter, the response includes this parameter and its value. 
        $request->strAttr = "test";
        // Optional. The user-defined content. The value can be up to 4,096 characters in length. 
        $request->customContent = "This is a sample description";
          
        try {
            $response = $client->updateImage($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(3) {
      ["Code"]=>
      int(0)
      ["RequestId"]=>
      string(36) "2CD69717-846D-167A-89AD-647213332248"
      ["Success"]=>
      bool(true)
    }

Detail

  • Sample code

    function _detail()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new DetailRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
          
        try {
            $response = $client->detail($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(3) {
      ["Instance"]=>
      array(8) {
        ["Capacity"]=>
        int(10)
        ["Name"]=>
        string(19) "xxxxxxx"
        ["Qps"]=>
        int(1)
        ["Region"]=>
        string(11) "cn-shanghai"
        ["ServiceType"]=>
        int(0)
        ["TotalCount"]=>
        int(99999)
        ["UtcCreate"]=>
        int(1620382716000)
        ["UtcExpireTime"]=>
        int(1623081600000)
      }
      ["RequestId"]=>
      string(36) "41465B01-11B4-149D-BB6F-BB498B3C39F0"
      ["Success"]=>
      bool(true)
    }

DumpMeta

  • Sample code

    function _dumpMeta()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new DumpMetaRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
          
        try {
            $response = $client->dumpMeta($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(3) {
      ["Data"]=>
      array(2) {
        ["DumpMetaStatus"]=>
        string(10) "PROCESSING"
        ["Id"]=>
        int(572)
      }
      ["RequestId"]=>
      string(36) "A1234E2C-C99E-122C-97D1-F30FE012533B"
      ["Success"]=>
      bool(true)
    }

DumpMetaList

  • Sample code

    function _dumpMetaList()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new DumpMetaListRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Optional. The ID of the task that is used to export metadata. 
        $request->id = 567;
        // Optional. The page number. Default value: 1. 
        $request->pageNumber = 1;
        // Optional. The number of entries per page. Default value: 20. 
        $request->pageSize = 1;
          
        try {
            $response = $client->dumpMetaList($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(2) {
      ["Data"]=>
      array(4) {
        ["DumpMetaList"]=>
        array(1) {
          [0]=>
          array(7) {
            ["Code"]=>
            string(1) "0"
            ["Id"]=>
            int(567)
            ["MetaUrl"]=>
            string(208) "https://xx/xx"
            ["Msg"]=>
            string(7) "success"
            ["Status"]=>
            string(7) "SUCCESS"
            ["UtcCreate"]=>
            int(1639969113000)
            ["UtcModified"]=>
            int(1639969140000)
          }
        }
        ["PageNumber"]=>
        int(1)
        ["PageSize"]=>
        int(1)
        ["TotalCount"]=>
        int(1)
      }
      ["RequestId"]=>
      string(36) "46044936-BA2E-10E2-9C82-C00FF83862E5"
    }

BatchTask

  • Sample code

    function _batchTask()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new IncreaseInstanceRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Required. If images are stored in an Object Storage Service (OSS) bucket, enter the bucket name. 
        $request->bucketName = "xxxx";
        // Required. The path in which the images are stored. The path must start with a forward slash (/) and cannot end with a forward slash (/). 
        // Create a file named increment.meta in the path in which the images are stored. For more information, see "Perform batch operations" in User Guide. 
        $request->path = "/public/xxx";
        // Optional. The callback URL if the API call is successful. The URL must start with http:// or https://. 
        $request->callbackAddress = "http://xxx/xxx";
          
        try {
            $response = $client->increaseInstance($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(3) {
      ["Data"]=>
      array(2) {
        ["Id"]=>
        int(1475)
        ["IncrementStatus"]=>
        string(10) "PROCESSING"
      }
      ["RequestId"]=>
      string(36) "768C6C02-E3FE-1024-8461-103F7C529EFA"
      ["Success"]=>
      bool(true)
    }

BatchTaskList

  • Sample code

    function _batchTaskList()
    {
        $config = new Config();
        // For information about how to create an AccessKey pair, see "Create an AccessKey pair" at https://www.alibabacloud.com/help/en/resource-access-management/latest/accesskey-pairs-create-an-accesskey-pair-for-a-ram-user.
        // The AccessKey pair of an Alibaba Cloud account has the permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M. 
        // We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised. 
        // In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements. 
        $config->accessKeyId = getenv("CC_AK_ENV");
        $config->accessKeySecret = getenv("CC_SK_ENV");
        // Replace the value with the ID of the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the regionId parameter to cn-hangzhou.
        $config->regionId = "<regionId>";
        // Replace the value with the endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch.cn-hangzhou.aliyuncs.com.
        $config->endpoint = "imagesearch.[regionId].aliyuncs.com";
    
        // The following sample code provides an example on how to use a VPC endpoint to call the Image Search API.
        // Note: You can use a VPC endpoint to call the Image Search API only from ECS instances or resources that reside in the same region. For example, if your Image Search instance resides in the China (Shanghai) region, you can use a VPC endpoint to call the Image Search API only from the ECS instances or resources that reside in the China (Shanghai) region. Otherwise, the API operation fails to be called. In case of a failed API call, check whether your ECS instances or resources are in the same region as your Image Search instance before you call the Image Search API. 
        // $config->endpointType = "internal";  // If you want to use a VPC endpoint to call the Image Search API, you must specify the endpointType parameter and set the value to internal.
        // $config->endpoint = "imagesearch-vpc.[regionId].aliyuncs.com"; // The VPC endpoint that is used to call the Image Search API. Replace the value with the VPC endpoint in the region in which your Image Search instance resides. For example, if your Image Search instance resides in the China (Hangzhou) region, set the endpoint parameter to imagesearch-vpc.cn-hangzhou.aliyuncs.com.
    
        $client = new ImageSearch($config);
        $request = new IncreaseListRequest();
        // Required. The name of the Image Search instance. Enter the instance name instead of the instance ID. After an Image Search instance is purchased, you can view the instance name on the instance list page of the Image Search console at https://imagesearch.console.aliyun.com/overview.
        $request->instanceName = "xxxxxx";
        // Optional. The ID of the task. 
        $request->id = 567;
        // Optional. The name of the OSS bucket. 
        $request->bucketName = "xxxx";
        // Optional. The path to the OSS bucket. 
        $request->path = "/public/xxx";
        // Optional. The page number. Default value: 1. 
        $request->pageNumber = 1;
        // Optional. The number of entries per page. Default value: 20. 
        $request->pageSize = 1;
          
        try {
            $response = $client->increaseList($request);
            var_dump($response->body->toMap());
        } catch (TeaUnableRetryError $e) {
            var_dump($e->getLastException(), $e->getLastRequest());
          } catch (Exception $e) {
        }
    }
  • Sample response

    array(2) {
      ["Data"]=>
      array(4) {
        ["Increments"]=>
        array(1) {
          ["Instance"]=>
          array(1) {
            [0]=>
            array(9) {
              ["BucketName"]=>
              string(21) "xxxxx"
              ["Code"]=>
              string(1) "0"
              ["ErrorUrl"]=>
              string(226) "https://xx/xx"
              ["Id"]=>
              int(1464)
              ["Msg"]=>
              string(7) "success"
              ["Path"]=>
              string(23) "/public/xxx"
              ["Status"]=>
              string(6) "NORMAL"
              ["UtcCreate"]=>
              int(1639107872000)
              ["UtcModified"]=>
              int(1639125540000)
            }
          }
        }
        ["PageNumber"]=>
        int(1)
        ["PageSize"]=>
        int(1)
        ["TotalCount"]=>
        int(1)
      }
      ["RequestId"]=>
      string(36) "603C696F-EC04-101F-8767-29A63382237A"
    }