October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix 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 desk6 min

How to Use the ShrinkTheWeb API in a Laravel Website

A safe Laravel integration pattern for ShrinkTheWeb, with guidance on credentials, inside-page captures, legacy options, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Laravel can make the outbound HTTP request for a ShrinkTheWeb screenshot, but the available ShrinkTheWeb setup documentation is an older Drupal guide—not a current Laravel API specification. Before writing a production request, verify the current endpoint, authentication/signature rules, parameter names, response format, and account entitlements in your ShrinkTheWeb account. Laravel’s HTTP Client can then send the verified request and let your application inspect the response.

What to verify before integrating ShrinkTheWeb

The ShrinkTheWeb instructions available in the Drupal setup guide were last updated on 4 March 2019. They describe registering for the service and retrieving an Access key and Secret key from an account profile. They do not establish that those credentials, request fields, or the service endpoint are unchanged today.

As an Amazon Associate I earn from qualifying purchases.

Confirm these details against current ShrinkTheWeb documentation or your account before sending real requests:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The current API endpoint and whether the request uses GET, POST, or another method.
  • How the Access key and Secret key must be transmitted or used to sign a request. Do not assume the secret belongs in a query string.
  • Whether a successful response contains image bytes, a hosted image URL, or another result format.
  • Current names and meanings for screenshot dimensions, full-page capture, delay, quality, and other options.
  • Whether capturing a URL beyond its homepage or using other options requires a current plan upgrade.

The old Drupal guide names url, custom_width, full_length, max_height, native_resolution, widescreen_resolution_y, delay, and quality. It describes delay in seconds after page load and quality from 1 to 100, and says capturing a non-homepage page requires the “Inside Pages” upgrade. Treat these as historical Drupal integration details, not a verified current API contract or guarantee of present-day entitlements.

Configure Laravel to keep credentials server-side

Use Laravel’s HTTP Client, rather than exposing provider credentials in a browser request. Store secrets in environment-backed configuration and keep them out of Blade templates, JavaScript, public image URLs, source control, and logs. Laravel’s HTTP Client documentation describes the framework’s outbound request and response APIs; the reviewed page is for Laravel 12.x and points readers to Laravel 13.x because it is marked old, so use the documentation version matching your application.

  1. Put the verified API endpoint and any required credentials in your deployment environment, not in committed source.
  2. Map those values in config/services.php, for example under a shrinktheweb key. Use the exact credential names and transmission method that ShrinkTheWeb currently documents.
  3. Validate user-submitted target URLs before making a request. Restrict schemes to HTTP and HTTPS and, where appropriate, restrict allowed hosts to reduce server-side request forgery risk.
  4. Make a finite-timeout request and inspect status and content type before treating the response as an image.

Do not paste the following as a ready-to-run ShrinkTheWeb call. It is a Laravel request pattern only: the endpoint and authentication contract are intentionally left as configuration placeholders because the current ShrinkTheWeb-specific values are not established by the available service documentation.

<?php

use IlluminateSupportFacadesHttp;
use RuntimeException;

// Validate and normalize $targetUrl before this point.
$response = Http::timeout(20)->get(
    config('services.shrinktheweb.endpoint'),
    [
        // Add only parameters verified against the current ShrinkTheWeb API contract.
        'url' => $targetUrl,
    ]
);

if (! $response->successful()) {
    // Log a safe status/error summary only. Do not log secrets or credential URLs.
    throw new RuntimeException('Screenshot request failed.');
}

$contentType = $response->header('Content-Type');
if (! is_string($contentType) || ! str_starts_with($contentType, 'image/')) {
    throw new RuntimeException('The screenshot service did not return an image.');
}

$imageBytes = $response->body();
// Store or return the bytes only after confirming the provider's response format.

Laravel documents query-parameter arrays, headers, finite request options, and response methods such as body(), status(), successful(), and failed(). If the current ShrinkTheWeb API requires headers or request signing, adapt the request to its verified contract; do not put a secret into the query array merely because it is convenient.

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.

Capture an inside page or customize the screenshot

To capture an inside page, send its complete URL as the target only if the current API supports that use and your account has the required entitlement. The 2019 Drupal guide says “Inside Pages” was an upgrade for non-homepage captures; check current account terms rather than relying on that historical statement.

Similarly, do not assume the legacy Drupal option names map directly to today’s API. Confirm the currently supported fields and allowed values before exposing them as Laravel form inputs or configuration. In particular, verify which dimension controls width or height, whether full-page capture is supported, how delay is measured, and what quality values mean for the response format you request.

Handle failures, caching, and security

Diagnose the result before saving it

  • Non-success HTTP status: inspect the status and provider’s documented error format. Report a generic application error to the user; log only a safe diagnostic summary.
  • Successful status but no image: inspect Content-Type and the documented response schema. The endpoint may return a URL or structured data rather than image bytes.
  • Wrong or missing page: verify the full target URL, redirects, access restrictions on the target site, and any current service options for page capture or render delay.
  • Timeout: retain a finite timeout, then decide whether to retry based on the provider’s documented behavior. Avoid unbounded retries that can amplify latency or charges.

Cache generated results deliberately

The historical Drupal guide discusses caching screenshots and setting a cache duration. In Laravel, cache the stored image or resulting provider URL according to your freshness needs and the provider’s current terms. Choose a cache key that includes the normalized target URL and any options that affect the output; otherwise, a request with different dimensions or capture settings could incorrectly reuse an old result.

Protect your application

  • Never accept arbitrary internal network targets from users; block loopback, private, link-local, and other disallowed destinations as appropriate to your application.
  • Limit URL length and validate schemes, hosts, and redirects.
  • Do not return provider credentials or secret-bearing request URLs to the browser.
  • Set request timeouts and reasonable application-level rate limits.
  • Store returned image data using a controlled disk or object-storage policy, and avoid trusting a filename or MIME type supplied by an untrusted source without validation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why not install the Drupal module in Laravel?

The ShrinkTheWeb project page on Drupal.org marks its Drupal module unsupported and obsolete, and says it appeared no longer supported as of 31 January 2022: Drupal.org project status. That status applies to the Drupal integration, not necessarily to the ShrinkTheWeb service. It is not a maintained Laravel package recommendation; Laravel’s built-in HTTP Client is the direct framework-level option for an API integration.

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

Or skip the browser setup

If you want a screenshot API with a documented one-call flow instead, ScreenshotNeo returns a screenshot or PDF from one GET request. Cookie banners are accepted and removed before capture, along with known newsletter popups and chat widgets; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. It also has an MCP server for AI agents, and its free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.

Example cURL request (replace the target URL and supply your key):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options and response details, or sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Can I safely copy the Laravel example as a working ShrinkTheWeb request?

No. It demonstrates Laravel’s request and response handling; the current ShrinkTheWeb endpoint, authentication scheme, and response format must be verified first.

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

Does the unsupported Drupal module mean ShrinkTheWeb itself is discontinued?

No. The Drupal.org status describes the Drupal module, not the service as a whole.

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 *

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.

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
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.