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:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- 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
- 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.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #3
- 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=screencaptures the visible screen and is the documented default;size=pagerequests the full page. - Freshness and cache: Browshot’s API documentation describes using a prior screenshot within its cache window by default; set
cache=0when you need to request a fresh capture. Freshness and account credit use can differ, so check current service terms. - JavaScript timing: Set
delayto 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
- 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.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 onfinishedorerror, 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
screenorpagebased 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.phpis 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.
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
- 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.
Quick Recap
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.
Recommended Free Tools




