> For the complete documentation index, see [llms.txt](https://docs.autocontentapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autocontentapi.com/code-samples/explainer-videos/php/set-duration.md).

# Choose Explainer Video Format

PHP cURL script that picks the short explainer video format in the payload, with explainer as the default and cinematic as another option.

This snippet recreates the [🎬 Choose Explainer Video Format](https://docs.autocontentapi.com/quick-start/explainer-videos/set-duration.md) recipe using PHP. Review the [PHP guide](https://docs.autocontentapi.com/code-samples/language-quickstarts/php.md) for environment setup before running it.

```php
<?php

$token = getenv('AUTOCONTENT_TOKEN') ?: 'YOUR_API_TOKEN';
$endpoint = 'https://api.autocontentapi.com/content/Create';

$payload = [
  'outputType' => 'video',
  'resources' => [
    [
      'type' => 'youtube',
      'content' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
    ]
  ],
  'text' => 'Summarize the key arguments in plain language.',
  'format' => 'short'
];

$body = json_encode($payload);
if ($body === false) {
    fwrite(STDERR, 'Failed to encode payload: ' . json_last_error_msg() . "\n");
    exit(1);
}

$ch = curl_init($endpoint);
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $token,
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
if ($response === false) {
    fwrite(STDERR, 'Request failed: ' . curl_error($ch) . "\n");
    curl_close($ch);
    exit(1);
}

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($status >= 400) {
    fwrite(STDERR, "HTTP $status\n$response\n");
    exit(1);
}

echo "Request accepted:\n" . $response . "\n";
```

Replace `YOUR_API_TOKEN` (or set the `AUTOCONTENT_TOKEN` environment variable) before running the request.

Available formats: `explainer` (default), `short`, and `cinematic` (100 credits).

**See also**

* [Scenario overview](https://docs.autocontentapi.com/quick-start/explainer-videos/set-duration.md)
* [PHP guide](https://docs.autocontentapi.com/code-samples/language-quickstarts/php.md)
