PHP code example of google / cloud-automl
1. Go to this page and download the library: Download google/cloud-automl 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/ */
google / cloud-automl example snippets
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\AnnotationSpec;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\GetAnnotationSpecRequest;
// Create a client.
$autoMlClient = new AutoMlClient();
// Prepare the request message.
$request = (new GetAnnotationSpecRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AnnotationSpec $response */
$response = $autoMlClient->getAnnotationSpec($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}