> For the complete documentation index, see [llms.txt](https://vd-docs.visolix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vd-docs.visolix.com/getting-started/external-download-server.md). Agents can also search and read this documentation through its [MCP server](https://vd-docs.visolix.com/~gitbook/mcp).

# External Download Server

The External Download Server feature allows you to offload video downloads to a secondary server, saving bandwidth on your main WordPress server. This is particularly useful for high-traffic websites.

## How It Works

When enabled, download requests are routed through an external PHP script hosted on your secondary server. The download is processed securely with:

* **AES-256-CBC Encryption** - Download URLs are encrypted to prevent tampering
* **HMAC Signature Verification** - Requests are signed using your Token Security Key
* **Link Expiration** - Download links automatically expire for security
* **Platform-Optimized Streaming** - Different download strategies for each platform

## Setup Instructions

### Step 1: Generate Token Security Key

1. Go to **Visolix Video Downloader → Settings → General**
2. Click **Generate Token** button next to "Token Security Key"
3. Click **Save Settings**

> \[!IMPORTANT] The Token Security Key is required for secure communication between your WordPress site and the external server.

### Step 2: Download the External Script

1. Go to **Visolix Video Downloader → Settings → External Download Server**
2. Click the **Download visolix-dl.php** button
3. The downloaded file is pre-configured with your Token Security Key

### Step 3: Upload to External Server

1. Upload `visolix-dl.php` to your external server (VPS or dedicated server)
2. Ensure the file is accessible via HTTP/HTTPS (e.g., `https://dl.example.com/visolix-dl.php`)

#### Server Requirements

| Requirement    | Minimum                 |
| -------------- | ----------------------- |
| PHP Version    | 8.0+                    |
| PHP Extensions | OpenSSL, cURL           |
| Memory Limit   | 256MB+                  |
| Execution Time | Unlimited (recommended) |

### Step 4: Configure Plugin Settings

1. Go to **Visolix Video Downloader → Settings → External Download Server**
2. Enter your **External Server URL** (e.g., `https://dl.example.com/visolix-dl.php`)
3. Select which **Platforms** should use the external downloader
4. Click **Save Settings**

## Enabled Platforms

You can choose which platforms use the external download server. Unselected platforms will continue to download through your main WordPress server.

**Supported Platforms:**

* Instagram
* TikTok
* Facebook
* Snapchat (non-HLS only)
* ShareChat
* Moj
* Telegram
* Ok.ru (Odnoklassniki)

## Limitations

> \[!WARNING] **HLS Streams Not Supported**
>
> The external download server does not support HLS/m3u8 video streams (e.g., Snapchat stories). These downloads require FFmpeg and will always be processed through your main WordPress server, regardless of platform settings.

## Security Features

| Feature            | Description                                     |
| ------------------ | ----------------------------------------------- |
| Encrypted Payloads | Download URLs are AES-256-CBC encrypted         |
| HMAC Signatures    | Requests are verified using SHA-256 HMAC        |
| Link Expiration    | Download links expire after a set time          |
| Platform Headers   | Platform-specific headers prevent access issues |

## Environment Variables (Optional)

Instead of hardcoding the secret key, you can use environment variables on your external server:

```bash
# Add to your server environment
export VISOLIX_SECRET_KEY="your_token_security_key_here"
```

The script will automatically use this if the key is not hardcoded.

## Troubleshooting

### Downloads Not Starting

1. Verify the External Server URL is correct and accessible
2. Ensure the Token Security Key matches in both plugin settings and the PHP script
3. Check that the external server has cURL and OpenSSL extensions enabled

### 403 Forbidden Errors

* The download link may have expired
* The Token Security Key might not match between plugin and external script
* Regenerate the Token Security Key and re-download the script

### Slow Downloads

* Ensure your external server has sufficient bandwidth
* Check if your external server has output buffering disabled
* Verify `max_execution_time` is set to 0 (unlimited)

## Best Practices

1. **Use HTTPS** - Always use HTTPS for your external server URL
2. **Dedicated Server** - Use a VPS or dedicated server with good bandwidth
3. **CDN Compatible** - Place the external server geographically close to your users
4. **Monitor Usage** - Track bandwidth usage on your external server
5. **Regular Updates** - Re-download the script after plugin updates for latest optimizations
