Screenshot API for PHP
Capture website screenshots in PHP without wkhtmltoimage or any browser dependency. One HTTP call. Get back an image.
Quick Start
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://grabshot.dev/v1/screenshot?" . http_build_query([
"url" => "https://stripe.com",
"format" => "png",
"width" => "1280",
"frame" => "macbook",
"key" => "YOUR_API_KEY",
]),
CURLOPT_RETURNTRANSFER => true,
]);
$image = curl_exec($ch);
curl_close($ch);
file_put_contents("screenshot.png", $image);
Laravel — Generate OG Images
// routes/web.php
Route::get('/og/{page}', function ($page) {
$response = Http::get("https://grabshot.dev/v1/screenshot", [
"url" => "https://mysite.com/{$page}",
"width" => "1200",
"height" => "630",
"format" => "png",
"key" => config("services.grabshot.key"),
]);
return response($response->body())
->header("Content-Type", "image/png")
->header("Cache-Control", "public, max-age=86400");
});
Start capturing screenshots in PHP
25 free screenshots per month. No credit card required.
Get Free API Key →