PHP code example of google / cloud-apigee-connect
1. Go to this page and download the library: Download google/cloud-apigee-connect 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-apigee-connect example snippets
use Google\ApiCore\ApiException;
use Google\ApiCore\BidiStream;
use Google\Cloud\ApigeeConnect\V1\Client\TetherClient;
use Google\Cloud\ApigeeConnect\V1\EgressRequest;
use Google\Cloud\ApigeeConnect\V1\EgressResponse;
// Create a client.
$tetherClient = new TetherClient();
// Prepare the request message.
$request = new EgressResponse();
// Call the API and handle any network failures.
try {
/** @var BidiStream $stream */
$stream = $tetherClient->egress();
$stream->writeAll([$request,]);
/** @var EgressRequest $element */
foreach ($stream->closeWriteAndReadAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}