October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

How to Use Browserless Screenshots in a WordPress Site Hosted in India

Use WordPress’s HTTP API to request Browserless screenshots server-side, save the returned image bytes, and embed cached results safely. Includes capture settings, India region considerations, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can capture a webpage with Browserless from an India-hosted WordPress site by sending a server-side HTTPS POST request to Browserless’s /screenshot endpoint, then saving or serving the returned image bytes. Use WordPress’s HTTP API, keep the Browserless token out of browser code, and cache the result rather than generating a new capture for every visitor.

How the Browserless-to-WordPress flow works

  1. Your WordPress PHP code sends a JSON POST request to Browserless over HTTPS. The request contains an API token and either a page URL or inline HTML, plus any capture options.
  2. Browserless returns binary image data, not an HTML page. Your code must handle those bytes—for example, save them as a file and use the file URL in a post or shortcode.
  3. A shortcode can insert the saved image into content. Its callback should return the markup rather than print it directly.

This is a documentation-based integration pattern, not a verified Browserless-specific WordPress plugin. Browserless documents the request and capture options in its Screenshot API reference; WordPress documents outbound requests in its HTTP API guide and content insertion through add_shortcode().

As an Amazon Associate I earn from qualifying purchases.

Set up a safe server-side integration

Keep credentials and URL selection on the server

Store the Browserless token in server-side configuration or an environment-backed secret. Browserless’s shared REST examples put the token in a query parameter, so avoid logging complete request URLs where practical. Do not put the token in a shortcode attribute, page HTML, or JavaScript sent to visitors.

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

Prefer generating the capture URL from a trusted WordPress object or an administrator-controlled setting. Do not let arbitrary visitors submit URLs for your server to fetch; that can turn the site into an unintended proxy. If you accept editor-provided values, validate that they use HTTPS and match the destinations your site is meant to capture.

Check the hosting environment

Confirm that your hosting plan allows PHP outbound HTTPS requests, that the server’s request timeout is long enough for the target page, and that configuration secrets can be stored securely. These are checks for your own host; there is no provider-specific India hosting compatibility or measured India-to-Browserless latency established here.

Request a screenshot with WordPress’s HTTP API

The following plugin-style example shows the essential request and response handling. Put the token in wp-config.php or another server-side secret store as BROWSERLESS_TOKEN. Replace the target URL with a trusted URL. The example saves the returned bytes in the WordPress uploads directory; production code should also apply your own URL allowlist, cache policy, and error logging rules.

<?php
// In wp-config.php or an equivalent server-side configuration:
define( 'BROWSERLESS_TOKEN', 'YOUR_BROWSERLESS_TOKEN' );

function site_capture_with_browserless( $target_url ) {
    if ( ! defined( 'BROWSERLESS_TOKEN' ) || ! BROWSERLESS_TOKEN ) {
        return new WP_Error( 'missing_browserless_token', 'Browserless token is not configured.' );
    }

    // Restrict target URLs in production to destinations your site trusts.
    if ( ! filter_var( $target_url, FILTER_VALIDATE_URL ) || 'https' !== wp_parse_url( $target_url, PHP_URL_SCHEME ) ) {
        return new WP_Error( 'invalid_target_url', 'Provide a valid HTTPS target URL.' );
    }

    $endpoint = add_query_arg(
        'token',
        rawurlencode( BROWSERLESS_TOKEN ),
        'https://production-sfo.browserless.io/screenshot'
    );

    $response = wp_remote_post( $endpoint, array(
        'timeout' => 90,
        'headers' => array(
            'Content-Type' => 'application/json',
        ),
        'body' => wp_json_encode( array(
            'url' => $target_url,
            'options' => array(
                'type' => 'png',
                'fullPage' => true,
            ),
        ) ),
    ) );

    if ( is_wp_error( $response ) ) {
        return $response;
    }

    $status = wp_remote_retrieve_response_code( $response );
    $image  = wp_remote_retrieve_body( $response );
    $type   = wp_remote_retrieve_header( $response, 'content-type' );

    if ( 200 !== $status || '' === $image || false === strpos( (string) $type, 'image/' ) ) {
        return new WP_Error( 'browserless_capture_failed', 'Browserless did not return a successful image response.' );
    }

    $uploads = wp_upload_dir();
    if ( ! empty( $uploads['error'] ) ) {
        return new WP_Error( 'upload_directory_error', $uploads['error'] );
    }

    $filename = 'browserless-' . wp_generate_password( 12, false, false ) . '.png';
    $path     = trailingslashit( $uploads['path'] ) . $filename;
    $written  = file_put_contents( $path, $image );

    if ( false === $written ) {
        return new WP_Error( 'image_save_failed', 'Could not save the screenshot.' );
    }

    return array(
        'path' => $path,
        'url'  => trailingslashit( $uploads['url'] ) . $filename,
    );
}

function site_browserless_image_shortcode( $atts ) {
    $atts = shortcode_atts( array( 'src' => '' ), $atts, 'browserless_image' );
    $src  = esc_url( $atts['src'] );

    if ( ! $src ) {
        return '';
    }

    return '<img src="' . $src . '" alt="" loading="lazy" />';
}
add_shortcode( 'browserless_image', 'site_browserless_image_shortcode' );
?>

The endpoint host shown is an example shared-cloud region. Select the endpoint appropriate to your Browserless account and region; the reviewed documentation does not establish an India shared-cloud execution endpoint. The code checks for a successful HTTP response and an image content type before writing bytes, but it is a starting point rather than a complete production plugin. Add access controls around any action that triggers a capture, avoid regenerating images on every page view, and remove or expire obsolete files.

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

Choose capture settings for the page

Browserless supports PNG, JPEG, and WebP output, quality and viewport controls, full-page capture, clipping, device scale factor, and selector-specific capture. Use only the settings your page needs; larger viewports, full-page captures, and waiting for slow content can increase request time.

  • Full page: set fullPage: true in the capture options when the image should include content beyond the initial viewport.
  • One element: pass selector at the top level beside url to capture a specific element.
  • Lazy-loaded content: use the documented scrollPage: true request option when the page needs scrolling to load images or other deferred elements.
  • Readiness: wait for a selector, event, function, or timeout if the content is not ready immediately after navigation.
  • Output and layout: select PNG, JPEG, or WebP and set viewport, quality, clipping, or device scale factor to suit the intended display.

For inline HTML, send html instead of url; do not include both in the same request. See the Browserless Screenshot API documentation for exact option syntax supported by the endpoint.

Return the image in a WordPress post or page

The response body is image data, so it is not suitable for direct insertion as page text. Save it to a file or another storage location, then use the resulting image URL in an <img> element. A shortcode is one way to insert that markup; WordPress’s shortcode reference says callbacks return replacement content. For a workflow that captures dynamically, keep the capture behind an administrator-controlled action or a scheduled job and have the shortcode display the already stored image.

India hosting, execution region, and data handling

An India-based WordPress server does not determine where Browserless runs its browser or stores related data. Browserless’s Trust Center says shared-fleet browser sessions execute in the region selected by the endpoint—San Francisco, London, or Amsterdam. It also says stored or forwarded information, including telemetry, logs, session replays, saved profiles, and crawl results, may remain in US infrastructure. The official material reviewed does not establish an India shared-cloud execution endpoint.

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.

If your workflow requires execution and storage under infrastructure you control, Browserless offers self-hosting in a customer VPC, data center, or on-premises environment. That shifts infrastructure operations to you. Browserless identifies its open-source Docker image as SSPL-1.0 and says closed-source commercial use or closed-source CI requires a commercial license; check the current deployment and license terms before production use. Browserless says core screenshot API paths are available in self-hosted images, while some advanced endpoints are cloud-only.

Reliability, caching, and cost considerations

Do not generate the same screenshot on each public page view. Cache the saved image and refresh it only when the source page or your desired capture settings change. This is engineering guidance, not a documented WordPress or Browserless requirement. Set a timeout appropriate to your pages, surface errors to administrators rather than visitors, and avoid treating a non-image response as a valid screenshot.

For shared cloud, the WordPress server’s geographic location alone does not establish capture latency. No India-to-region latency measurement or specific Indian host restriction is established here. For self-hosting, plan to operate and monitor the browser infrastructure and verify that the endpoints your integration needs are available in that deployment.

Troubleshoot common capture failures

  • WordPress reports a timeout or connection error: check that the host permits outbound HTTPS, the endpoint is correct, and the PHP/WordPress timeout fits the target page’s load time.
  • The response is not an image: check the HTTP status, Browserless token, request body, and response content type. Do not save error text or JSON as a PNG.
  • The screenshot is blank or shows a CAPTCHA, 403, or access-denied page: Browserless says these outcomes can indicate that the target site is blocking browser automation. Treat it as a target-site restriction, not as a normal rendering bug. Browserless separately documents an /unblock product for some bot-protection cases; applicability and permitted use depend on the target site and service terms. See its REST API overview.
  • An element is missing: confirm the selector matches the rendered page and add an appropriate readiness wait. For deferred content, consider scrolling before capture with scrollPage: true.
  • The output is clipped or unexpectedly small: check viewport dimensions, full-page versus viewport capture, clipping settings, and device scale factor.
  • Uploads fail: verify that WordPress can write to the uploads directory and inspect the error returned by wp_upload_dir() or the file write.
  • The same page is captured repeatedly: store the image URL and reuse it until a deliberate refresh; a shortcode that triggers a remote request for every visitor can add latency and unnecessary API use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-request endpoint can return an image or PDF, so WordPress code can call it server-side instead of managing a Browserless browser request. For PHP, use WordPress’s HTTP API to make a GET request with your server-side access key and target URL:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$response = wp_remote_get( 'https://api.screenshotneo.com/v1/shot?' . http_build_query( array(
    'access_key' => 'YOUR_API_KEY',
    'url'        => 'https://stripe.com',
) ), array( 'timeout' => 90 ) );

Keep the key in server-side configuration, handle the response as binary image data, and save or cache it before embedding it in WordPress. See the ScreenshotNeo documentation for request options.

  • Cookie banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
  • Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and responses identify the page verdict and billing status in headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up free for ScreenshotNeo to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Can a WordPress shortcode generate a screenshot on every page view?

It can trigger server-side work, but generating a remote capture per visitor adds latency and repeated API use. A more reliable pattern is to capture through a controlled action or scheduled job and have the shortcode display a stored image.

Does Browserless shared cloud provide an India execution region?

The official material reviewed establishes San Francisco, London, and Amsterdam for shared-fleet execution, but does not establish an India shared-cloud endpoint.

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

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.

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. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
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.