To use the PHP SDK to initiate an API call, initialize a client instance and modify the client configurations as needed.

Precautions

When creating a client instance, you must specify the region and the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
  • For more information about the supported regions, see Request structure.
  • For more information about how to obtain the AccessKey ID and AccessKey secret of your Alibaba Cloud account, see Create an AccessKey.

Create a client instance to moderate images, audio, videos, and text

The following regions are supported:
  • cn-shanghai: China (Shanghai)
  • cn-beijing: China (Beijing)
  • ap-southeast-1: Singapore
  • us-west-1: US (Silicon Valley)
Use the following code to create a client instance to moderate images, audio, videos, and text:
// Use the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
$iClientProfile = DefaultProfile::getProfile("cn-shanghai", "Your AccessKey ID", "Your AccessKey secret"); 
DefaultProfile::addEndpoint("cn-shanghai", "cn-shanghai", "Green", "green.cn-shanghai.aliyuncs.com");
$client = new DefaultAcsClient($iClientProfile);
Note You can replace cn-shanghai in the preceding code with cn-beijing, ap-southeast-1, or us-west-1 to create a client instance in the corresponding region.