Screenshot API in PHP

Capture any URL as a PNG, JPEG, WebP, or PDF from your PHP app — without installing wkhtmltopdf or running Chrome on your server. Works with plain PHP, Laravel, Symfony, WordPress.

100 free screenshots/month · No headless Chrome on your box

Plain PHP with cURL

<?php $url = 'https://api.aisnapapi.com/v1/screenshot?url=' . urlencode('https://example.com'); $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'], ]); $png = curl_exec($ch); file_put_contents('shot.png', $png);

Even shorter: file_get_contents

<?php $ctx = stream_context_create(['http' => [ 'header' => "Authorization: Bearer YOUR_API_KEY\r\n", ]]); $png = file_get_contents( 'https://api.aisnapapi.com/v1/screenshot?url=' . urlencode('https://example.com'), false, $ctx ); file_put_contents('shot.png', $png);

Laravel: stream a screenshot to the browser

<?php use Illuminate\Support\Facades\Http; Route::get('/screenshot', function () { $res = Http::withToken(env('SNAPAPI_KEY')) ->get('https://api.aisnapapi.com/v1/screenshot', [ 'url' => request('url'), 'full_page' => true, ]); return response($res->body(), $res->status()) ->header('Content-Type', 'image/png'); });

Guzzle (any framework)

<?php use GuzzleHttp\Client; $client = new Client(); $res = $client->get('https://api.aisnapapi.com/v1/screenshot', [ 'query' => ['url' => 'https://example.com', 'format' => 'pdf'], 'headers' => ['Authorization' => 'Bearer YOUR_API_KEY'], ]); file_put_contents('page.pdf', $res->getBody());

Common gotchas

Start with 100 free screenshots / month

No credit card. No upsell wall. 30-second signup.

Get My Free API Key