Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Browsershot

How to Generate Screenshots of Indian Ecommerce Category Pages in PHP with Browsershot

By Freedom251 Team · · 6 min read

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

Use Spatie’s Browsershot package to render an authorized category-page URL in headless Chrome, then save the result as an image. Start with a fixed viewport; use fullPage() for the full listing or select() to capture just the product grid. The page’s JavaScript, lazy loading, and consent interface determine what additional waiting or configuration is needed, so the example below is a starting point—not a verified integration for any particular Indian retailer.

What you need before capturing a category page

Browsershot is a PHP interface to Puppeteer, which controls headless Google Chrome to render pages as images or PDFs. Its URL-based API can save a rendered page directly to a file. Spatie’s Browsershot repository and official documentation describe the package and its options.

As an Amazon Associate I earn from qualifying purchases.

  • Install the Browsershot version appropriate for your project and follow its version-specific setup instructions.
  • Ensure the environment running PHP can locate Node.js and a Chrome or Chromium binary. This includes the production container or server, not just your development machine.
  • Use a URL you own or are authorized to capture, and check the site’s terms and access rules.
  • Decide whether you need the initial viewport, the complete page, or only the product-grid element.

Do not assume a retailer’s current markup, anti-bot behavior, consent prompts, or page readiness from a generic example. No named Indian ecommerce site is validated here.

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

Capture a category page to PNG

This minimal PHP example requests the page and saves the rendered result to an application-controlled path:

#1 Best Overall
Sale
Apple 2025 MacBook Pro Laptop with Apple M5 chip with 10‑core CPU and 10‑core GPU: Built for AI, 14.2-inch Liquid Retina XDR Display, 24GB Unified Memory, 1TB SSD Storage; Space Black
  • SUPERCHARGED BY M5 — The 14-inch MacBook Pro with M5 brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. Featuring all-day battery life and a breathtaking Liquid Retina XDR display with up to 1600 nits peak brightness, it’s pro in every way.*
  • HAPPILY EVER FASTER — Along with its faster CPU and unified memory, M5 features a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR APPLE INTELLIGENCE — Apple Intelligence is the personal intelligence system that helps you write, express yourself, and get things done effortlessly. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.
  • APPS FLY WITH APPLE SILICON — All your favorites, including Microsoft 365 and Adobe Creative Cloud, run lightning fast in macOS.*
<?php

use SpatieBrowsershotBrowsershot;

$url = 'https://example.com/category';
$output = storage_path('app/category.png');

Browsershot::url($url)
    ->save($output);

Replace the example URL with the category page you are permitted to capture. In a non-Laravel PHP project, replace storage_path() with a path that exists and is writable by the PHP process. This captures the page using the browser’s default capture behavior; choose an explicit viewport or capture scope when the image must be consistent across runs.

Choose the capture area and viewport

Browsershot documents several ways to control what is included. Match the method to the intended artifact rather than relying on a guessed screenshot height.

Need Browsershot option What it captures
What appears in the initial browser window windowSize(width, height) A viewport with the dimensions you set.
The full listing page fullPage() The full document, which may become a very tall image.
A known rectangular region clip(x, y, width, height) A crop at the coordinates and dimensions you provide.
Just the product grid select(selector) The element matching your CSS selector.
A mobile rendering mobile() Mobile emulation that accounts for the page’s meta viewport.

For example, a viewport-sized capture can set its dimensions explicitly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Lenovo ThinkPad L16 Gen 2 Business AI Laptop, 16" FHD+, Intel Core Ultra 7 255U, 32GB DDR5, 1TB SSD, HDMI, Fingerprint, Backlit, Wi-Fi 6E, Long Battery Life, Windows 11 Pro, 7-in-1 USB-C Hub Bundle
  • [Built for Heavy Multitasking & Business Workloads] Configured with 32GB high-bandwidth DDR5 RAM and a 1TB PCIe NVMe M.2 SSD, this laptop handles large spreadsheets, data analysis, presentations, CRM systems, browser-heavy workflows, and AI-assisted business tools with ease—ideal for professionals working across multiple applications all day.
  • [Business-Class Performance with Intel Core Ultra 7] Powered by the Intel Core Ultra 7 255U Processor (12 Cores, 14 Threads, up to 5.2GHz), delivering strong multi-core performance, integrated AI acceleration, and energy-efficient operation. Designed for enterprise users, analysts, developers, and managers who need consistent, reliable performance for long work sessions—not just short bursts.
  • [16" Productivity Display – More Space, Less Scrolling] Features a 16″ WUXGA (1920×1200) IPS display with 16:10 aspect ratio, antiglare coating, and 400 nits brightness, providing more vertical workspace for documents, coding, dashboards, financial models, and multitasking, making it more efficient than standard 16:9 laptops.
  • [Enterprise-Ready Connectivity & Security] 2 x USB-C (Thunderbolt 4, USB 40Gbps), 2 x USB-A (USB 5Gbps) – one always on, 1 x USB-A (hi-speed USB), 1x Headphone / mic comb, 1 x HDMI, 1 x Ethernet (RJ-45), 1 x Kensington Nano Security Slot, Fingerprint, Backlit Keyboard, Wi-Fi 6E + Bluetooth, Windows 11 Pro, supporting business security, remote management, virtualization, and professional workflows.
  • [ThinkPad L16 – Built for Mobility & Long-Term Business Use] Positioned above entry-level models, the ThinkPad L16 Gen 2 offers stronger build quality, MIL-STD-810H–tested durability, all-day battery life, and IT-friendly reliability, making it a smarter choice for corporate environments, managed deployments, remote work, and professionals upgrading from E-series or consumer laptops.
Browsershot::url($url)
    ->windowSize(1440, 1000)
    ->save($output);

For a full-page image, add fullPage(). For an element-only image, pass a selector that actually matches the grid on your target page. For a higher-density capture, Browsershot also documents adjusting the device scale factor. Confirm the exact method names and availability against the installed package version.

Wait for the product grid and deferred images

A category page may populate products with JavaScript or load images only as they approach the viewport. A screenshot taken too early can therefore show an empty grid, placeholders, or missing images. Browsershot documents waiting by delay, selector, JavaScript function, and for lazy-loaded resources; use a readiness condition tied to the page rather than assuming one fixed delay works everywhere. See the image creation and waiting options.

When the target page has a stable grid selector, a selector wait can make the capture depend on that element becoming available. Verify the selector against the current page and installed Browsershot API before relying on it. A selector appearing in the DOM does not necessarily prove every product image has finished loading, so inspect the output for the content your workflow requires.

Rank #3
Sale
Apple 2026 MacBook Pro Laptop with Apple M5 Pro chip with 15-core CPU and 16-core GPU: Built for AI, 14.2-inch Liquid Retina XDR Display, 24GB Unified Memory, 1TB SSD, Wi-Fi 7; Space Black
  • FAST RUNS IN THE FAMILY — The 14-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
  • BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
  • MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.

For full-page captures, deferred content may need to load before capture. Browsershot’s documented lazy-resource support can help, but the right readiness signal is page-specific. Record the URL, viewport, device scale, capture mode, and readiness condition when comparing images across runs.

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

Use Laravel Screenshot if you want a Laravel facade

Spatie also documents a separate Laravel Screenshot package. Its facade form is Screenshot::url($url)->save($path); its Browsershot driver has the same need for a usable Node.js and Chrome/Chromium runtime. The package also documents a Cloudflare Browser Rendering driver, which is a separate driver choice—not a feature of Browsershot itself. See Laravel Screenshot’s documentation and its Browsershot driver guide.

The Browsershot customization hook exposes the underlying instance for settings such as request headers, user agent, timeout, and dialog dismissal. Use the Laravel integration when its facade and driver configuration suit the application; use Browsershot directly when you want to work with the package API yourself.

Rank #4
Dell Precision 7680 Laptop, NVIDIA RTX 2000 Ada 8GB, i7-13850HX, 64GB DDR5 | 16" FHD+ Mobile Workstation, 1TB SSD, Intel 20-Core > Ultra 9 185H, Dell Pro Max, Engineer, Designer, Creator, Win 11 Pro
  • POWERFUL FOR CREATIVITY - The Dell Precision 7000 series, positioned at the apex of the Precision lineup, surpasses the 3000 and 5000 series and aligns closely with the evolving direction of the Dell Pro Max series. This top-tier 7680 features the NVIDIA RTX 2000 Ada 8GB GPU to deliver robust performance for professionals in design, architecture, photography, video editing, and engineering. Furthermore, the series' intelligent design for data science leverages AI to optimize system performance for key applications, enabling accelerated workflow efficiency
  • HIGH PERFORMANCE - Powered by Intel Core i7-13850HX vPro Processor for superior efficiency and speed, 64GB DDR5 CAMM RAM and 1TB PCIe NVMe M.2 SSD for seamless multitasking and fast storage. CAMM was designed specifically to overcome the performance limits of SODIMM while reducing both Z height and routing traces on the PCB to ultimately allow for laptops with both faster RAM and thinner profiles
  • CRISP DISPLAY - 16" FHD+ (1920 x 1200) Anti-Glare 45% NTSC display delivers crisp visuals, supported by the ability to connect 4 external monitors via HDMI, USB-C and Thunderbolt ports at 4K (3840x2160) @60Hz (without docking station). 1080p FHD RGB webcam for crystal-clear video calls
  • VERSATILE CONNECTIVITY - Equipped with 2x Thunderbolt 4, USB-C, 2x USB-A, HDMI, Ethernet (RJ-45), and an Audio combo jack. With Wi-Fi 6E and Bluetooth 5.2, ensuring fast wireless connectivity and compatibility with a wide range of peripherals. A full-size keyboard with a dedicated numeric keypad boosts productivity.
  • OPERATING SYSTEM - Windows 11 Pro 64‑bit, with AI‑powered Copilot, offers intelligent assistance to streamline complex professional workflows, enhance productivity, and support advanced multitasking across demanding applications. Built for workstation‑class computing, it delivers enterprise‑grade security and IT manageability

Save and verify the result

Write the file to a directory that the application controls and the PHP process can write to. Then make verification part of your own workflow:

  • Check that the file exists and has nonzero size.
  • Open it or inspect its dimensions to confirm the expected viewport or full-page scope.
  • Check that product cards, prices, and images are present if those are required for the task.
  • Record the capture settings so later runs can be compared consistently.

These are implementation checks, not guarantees that a given retailer’s page will render successfully.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common Browsershot problems

Symptom Likely cause What to check
Node or Chrome cannot be found The runtime is missing or not discoverable in the environment executing PHP. Install the dependencies required by the Browsershot version in use and verify the configured executable paths in the actual server or container.
Screenshot is blank or the grid is absent The page has not rendered the expected content when capture begins, or the page did not load successfully. Confirm the URL is reachable from the runtime, then wait for a page-specific selector or other documented readiness condition and inspect the resulting image.
Some product images are missing Images may be deferred until scrolling or other page activity. Try the documented lazy-resource handling and validate the result against the target page; do not assume a universal delay.
The image is too tall or too short The capture scope does not match the intended result. Use a fixed viewport for the first screen, fullPage() for the document, or select()/clip() for a smaller region.
The selected grid is not captured The CSS selector may not match the live page or may identify a different element. Inspect the page’s current DOM and verify the selector before capture; merchant markup can change.
It works locally but not in deployment The deployment environment may lack Node.js, Chrome/Chromium, writable output storage, or the same executable configuration. Check dependencies, paths, permissions, and runtime configuration in the environment that runs the PHP job.

Or skip the browser setup

ScreenshotNeo offers a one-request screenshot API and an MCP server. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. AI agents can take screenshots through its MCP server. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.

Use the category URL you are authorized to capture in place of the example URL:

Best Value
Lenovo 15.6" Essential Laptop, 2026 Edition, 8GB DDR5 256GB SSD
  • POWERFUL PERFORMANCE FOR PRODUCTIVITY: Equipped with Intel 4-Core CPU and 8GB DDR5 RAM, this 2026 Edition Lenovo laptop delivers smooth multitasking for small business operations, student assignments, and daily office work. The 256GB SSD ensures fast boot times and quick file access, keeping you efficient throughout your workday.
  • CRYSTAL-CLEAR VISUAL EXPERIENCE: Features a 15.6-inch FHD (1920x1080) anti-glare display that reduces eye strain during extended use. Perfect for video conferences, document editing, spreadsheet analysis, and multimedia content consumption with vibrant colors and sharp details.
  • ALL-DAY BATTERY LIFE: Long-lasting battery keeps you productive without constantly searching for outlets. Ideal for students moving between classes, professionals working remotely, or anyone who needs reliable computing power throughout the day without interruption.
  • PORTABLE AND LIGHTWEIGHT DESIGN: Slim profile and portable construction make this laptop easy to carry in backpacks or briefcases. Perfect for students commuting to campus, business travelers, or remote workers who need computing power on the go without the bulk.
  • READY TO USE OUT OF THE BOX: Pre-installed with Windows 11, offering an intuitive interface, enhanced security features, and compatibility with essential business and educational software. Includes multiple USB ports, HDMI output, and wireless connectivity for seamless integration with your devices.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/category -o category.webp

See the ScreenshotNeo API documentation for request details. Sign up for the free plan: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Can Browsershot capture only the product grid?

Yes. Use its documented select(selector) option with a CSS selector that matches the grid on the page you are capturing.

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

Can Browsershot render HTML instead of a URL?

Yes. Browsershot accepts HTML input as well as a URL, and it can retrieve body HTML after JavaScript execution.

Does this code work with every Indian ecommerce site?

No. The page’s markup, loading behavior, consent prompts, and access controls vary. Validate the URL, selector, and readiness condition for each authorized target.

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.

BrowsershotecommerceHeadless ChromePHPSpatiewebsite screenshots

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.