October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Capture Website Screenshots with Browshot in PHP

Use Browshot’s PHP library to capture a simple screenshot or manage a configurable full-API job, with code for saving the returned image and handling failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a website screenshot with Browshot in PHP, install its PHP library, create a client with your API key, then call the Simple API for a straightforward image or the full API when you need configuration and control over an asynchronous job. Check the response before saving it: a request can still be processing or can fail instead of returning an image.

Choose the Browshot API route

Route Best for What to handle
Simple API A basic screenshot returned through one call It is easier but slower, and the request may redirect while Browshot processes the capture.
Full API Configurable captures and workflows where you want to track a job Create the screenshot, poll its status, then retrieve the image or a thumbnail.

Browshot’s official PHP documentation describes both options. The Simple API is the shortest path for a basic file; use the full API when you need settings such as full-page capture, a chosen viewport, or a controlled wait after page load. See the Browshot API documentation and Browshot PHP library documentation for current details.

Install the PHP library and prepare your API key

Browshot documents installation with Composer and direct inclusion of the library file. Its PHP page says the library requires PHP 5.1.6 or later. It shows this Composer command:

composer require browshot-php/browshot=dev-master

The documented package constraint is dev-master; confirm the current recommended version or constraint on Packagist before relying on it for a production deployment. After Composer installs dependencies, load the autoloader:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
<?php
require __DIR__ . '/vendor/autoload.php';

The documentation also allows including Browshot.php directly rather than using Composer. Initialize the client with your Browshot API key. Keep the key out of source control and public examples; retrieve it from an environment variable or a secret manager in a deployed application.

Capture and save an image with the Simple API

The following shows the basic call pattern using the official PHP client. The Simple API returns after the screenshot finishes or fails from the PHP caller’s perspective. Inspect the result before writing bytes to disk; do not assume every response is a valid PNG.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
<?php
require __DIR__ . '/vendor/autoload.php';

$apiKey = getenv('BROWSHOT_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set BROWSHOT_API_KEY before running this script.');
}

$browshot = new Browshot($apiKey);
$result = $browshot->simple(
    'https://example.com',
    array('format' => 'png')
);

// Check Browshot's returned status/code before treating the body as an image.
if (!isset($result['code']) || (int) $result['code'] !== 200) {
    $status = isset($result['code']) ? $result['code'] : 'unknown';
    throw new RuntimeException('Browshot screenshot failed; response code: ' . $status);
}

$image = isset($result['image']) ? $result['image'] : null;
if (!is_string($image) || $image === '') {
    throw new RuntimeException('Browshot returned no image data.');
}

if (file_put_contents(__DIR__ . '/screenshot.png', $image) === false) {
    throw new RuntimeException('Could not write screenshot.png');
}

Match the result keys and method signature to the installed library version: Browshot’s documentation also provides a file helper, and library details can change. If using the API directly rather than its client, follow redirects because a Simple API request can return HTTP 302 or 307 while the screenshot is being prepared.

Use the full API for configurable or asynchronous captures

The full workflow creates a screenshot job using the target URL and an instance ID. Browshot may return in_process; query the information endpoint until the status becomes finished or error, then retrieve the screenshot. The PHP documentation’s sample waits ten seconds between checks, but that interval is illustrative, not a universal optimum. Production code should use a bounded retry policy and an overall deadline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
<?php
require __DIR__ . '/vendor/autoload.php';

$apiKey = getenv('BROWSHOT_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set BROWSHOT_API_KEY before running this script.');
}

$browshot = new Browshot($apiKey);
$instanceId = 12;

$created = $browshot->screenshot_create(
    'https://example.com',
    $instanceId,
    array('size' => 'page')
);
if (!isset($created['id'])) {
    throw new RuntimeException('Browshot did not return a screenshot job ID.');
}
$screenshotId = $created['id'];

$deadline = time() + 180;
$status = null;
do {
    $info = $browshot->screenshot_info($screenshotId);
    $status = isset($info['status']) ? $info['status'] : null;

    if ($status === 'finished' || $status === 'error') {
        break;
    }
    if ($status !== 'in_process') {
        throw new RuntimeException('Unexpected Browshot job status.');
    }
    if (time() >= $deadline) {
        throw new RuntimeException('Timed out waiting for Browshot screenshot.');
    }
    sleep(5);
} while (true);

if ($status === 'error') {
    throw new RuntimeException('Browshot reported that screenshot processing failed.');
}

$image = $browshot->screenshot_image($screenshotId);
if (!is_string($image) || $image === '') {
    throw new RuntimeException('Browshot returned no screenshot image.');
}
if (file_put_contents(__DIR__ . '/screenshot.png', $image) === false) {
    throw new RuntimeException('Could not write screenshot.png');
}

Client method signatures and returned structures should be checked against the PHP library version you install; the example illustrates the create, inspect, and retrieve sequence documented by Browshot. The full API also supports retrieving a thumbnail where a smaller rendition is needed.

Set capture options deliberately

  • Page size: size=screen captures the visible screen and is the documented default; size=page requests the full page.
  • Freshness and cache: Browshot’s API documentation describes using a prior screenshot within its cache window by default; set cache=0 when you need to request a fresh capture. Freshness and account credit use can differ, so check current service terms.
  • JavaScript timing: Set delay to allow more time after page load for scripts or late-rendered content. A fixed delay can increase processing time and still may not suit every site.
  • Viewport: Set width and height when the rendered layout must match a specific browser size.
  • Targeting and output: Optional documented features include executing JavaScript, hiding popups, selecting an element by CSS target, saving rendered HTML, and requesting a thumbnail.
  • Form submissions and session data: Custom POST data is documented for form submissions. Custom referrer and cookie settings are documented as paid screenshot features. Only send data you are authorized to use, and treat cookies or POST bodies as credentials.

Understand processing responses, limits, and cost

Browshot documents HTTP 200 as a successful PNG response for the Simple API, 400 for an invalid request, 404 for a screenshot failure, and 302 when the screenshot is still in progress. Its documentation says a capture can take up to two minutes and recommends following 302/307 redirects to work around HTTP timeouts. For the full API, handle in_process, finished, and error as separate states rather than downloading immediately after creation.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Browshot documents instance 12 as the default free instance for Simple API requests when no instance ID is supplied, with up to 100 free screenshots per month. It says private and shared instances require a positive balance. These are vendor-stated terms in Browshot’s documentation, which has no publication date stated here; check your account and the current API pages before estimating ongoing usage. The PHP documentation also warns that running its sample code can consume credits.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

  • You saved JSON or an error page as a PNG: Inspect the HTTP code or library result before saving. A failure response is not image data; for a Simple API request, 400 indicates an invalid request and 404 indicates screenshot failure in Browshot’s documented response scheme.
  • The request appears to hang or times out: The Simple API may redirect during processing. Follow 302/307 responses; for longer work, use the full API and poll the job with a deadline rather than holding one web request open indefinitely.
  • The full API never reaches completion: Continue only while status is in_process, stop on finished or error, and add a maximum wait and retry count. Record the job ID and returned status for diagnosis.
  • The screenshot misses late content: Allow additional post-load time with delay, or use documented JavaScript and element-target options where appropriate. More waiting increases latency; validate against the actual page.
  • The page layout differs from the expected one: Set the viewport dimensions explicitly and choose screen or page based on whether you need the viewport or the whole document.
  • The API rejects a private capture or custom request data: Check the instance and balance, and verify that the requested feature is available to your account. Browshot documents custom referrer and cookie settings as paid-only.
  • The PHP client is missing or has unexpected method behavior: Confirm Composer installed the intended package version, that vendor/autoload.php is loaded, and that your method calls and response handling match that version’s documentation.

Or skip the browser setup: use ScreenshotNeo

ScreenshotNeo offers a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. It accepts cookie/consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, or another MCP client. There is a free allowance of 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PHP one-call example:

<?php
$key = getenv('SCREENSHOTNEO_API_KEY');
if (!$key) {
    throw new RuntimeException('Set SCREENSHOTNEO_API_KEY before running this script.');
}
$response = file_get_contents(
    'https://api.screenshotneo.com/v1/shot?access_key=' . rawurlencode($key) .
    '&url=' . rawurlencode('https://example.com')
);
if ($response === false) {
    throw new RuntimeException('ScreenshotNeo request failed.');
}
file_put_contents(__DIR__ . '/shot.webp', $response);

See the ScreenshotNeo API docs for request parameters and response handling. For this short PHP example, add the API’s documented response checks before treating the body as an image. ScreenshotNeo also supports full-page capture, element selection, device and viewport settings, PDF options, custom CSS and JavaScript, blocking requests, cache TTL, signed image links, async jobs, and bulk capture. Sign up for ScreenshotNeo to get 1,000 screenshots a month free with no card.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Frequently Asked Questions

Can I use Browshot’s Simple API without specifying an instance ID?

Browshot’s documentation says instance 12 is the default free instance for Simple API requests when no instance ID is supplied.

Can Browshot submit a form before taking the screenshot?

The API documentation describes custom POST data for form submissions; use it only with data you are authorized to submit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.