PHP code example of sharpapi / php-ecommerce-product-intro-generator
1. Go to this page and download the library: Download sharpapi/php-ecommerce-product-intro-generator 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/ */
sharpapi / php-ecommerce-product-intro-generator example snippets
harpAPI\EcommerceProductIntro\ProductIntroGeneratorClient;
use GuzzleHttp\Exception\GuzzleException;
$apiKey = 'your_api_key_here';
$client = new ProductIntroGeneratorClient(apiKey: $apiKey);
try {
$statusUrl = $client->generateProductIntro(
content: 'Your text content here',
language: 'English'
);
// Optional: Configure polling
$client->setApiJobStatusPollingInterval(10);
$client->setApiJobStatusPollingWait(180);
// Fetch results (polls automatically)
$result = $client->fetchResults($statusUrl);
$resultData = $result->getResultJson();
echo $resultData;
} catch (GuzzleException $e) {
echo "API error: " . $e->getMessage();
}