To display a website screenshot in a PHP page with Urlbox, install its Composer package, create a client with your API key and secret on the server, generate a signed render URL, and use that URL as an image source. For workflows that need to download, process, or store output, use Urlbox’s JSON API instead: it is a separate server-to-server flow with its own request format and authentication.
Choose the right Urlbox PHP integration
Urlbox accepts a webpage URL or HTML and can render screenshots and other outputs. Its overview also describes video, metadata, and HTML extraction; the API reference gives PNG and PDF as render examples. See the Urlbox documentation overview and API reference.
| Approach | Best fit | What your PHP app receives or creates | Authentication |
|---|---|---|---|
| Signed render link | Show a rendered image directly in an HTML page | A signed URL suitable for an image source | The Composer client signs the render options using your project credentials |
| JSON synchronous API | Request a render from a backend job or application workflow | A JSON response containing a temporary renderUrl and size information |
Authorization: Bearer YOUR_URLBOX_SECRET for POST /v1/render/sync |
These flows should not be conflated. The current API reference documents Bearer authentication for POST /v1/render/sync; Urlbox’s separate legacy Post API page describes HTTP Basic authentication for /v1/render. Use the authentication method documented for the endpoint you call, and check the live API reference if you use another endpoint.
Render a screenshot with the PHP Composer package
Urlbox’s PHP example uses the urlbox-php Composer package. It initializes Urlbox from an API key and secret, passes a URL and render options, then generates a signed URL. The official sample does not state a required PHP version or provide a Laravel compatibility matrix, so check package requirements and your framework setup before choosing deployment versions. Follow the official PHP example.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
Install and configure credentials
Install the package in your project with Composer:
composer require urlbox/urlbox-php
Keep credentials in server-side environment configuration rather than committing them to source control or sending them to the browser. The exact environment-variable names and package configuration depend on your app; the example below reads them from the process environment.
Generate a signed image URL
<?php
require __DIR__ . '/vendor/autoload.php';
use UrlboxScreenshotsUrlbox;
$apiKey = getenv('URLBOX_API_KEY');
$apiSecret = getenv('URLBOX_API_SECRET');
if (!$apiKey || !$apiSecret) {
throw new RuntimeException('Set URLBOX_API_KEY and URLBOX_API_SECRET on the server.');
}
$urlbox = Urlbox::fromCredentials($apiKey, $apiSecret);
$options = [
'url' => 'https://example.com',
'width' => 1280,
'height' => 800,
];
$screenshotUrl = $urlbox->generateSignedUrl($options);
?>
<img src="<?= htmlspecialchars($screenshotUrl, ENT_QUOTES, 'UTF-8') ?>" alt="Screenshot of example.com">
Replace https://example.com with the publicly accessible page you want rendered. The dimensions are optional render options; choose values appropriate for the layout you plan to display. Escaping the generated URL before inserting it into HTML prevents it from being interpreted as markup.
How signing and public links work
Urlbox’s render-link flow places the API key in the render link and can sign the query options with an HMAC-SHA256 token derived using the project secret. Changing signed options invalidates that token. Generate links on the server and prefer secure signed links where a URL will be exposed publicly; do not put the project secret in browser-delivered JavaScript. Details are in the quickstart and render links documentation.
Rank #2
Use the JSON API for backend workflows
Call POST https://api.urlbox.com/v1/render/sync when PHP needs to request a render as a backend operation and handle the API response. The request accepts JSON or form-encoded options and requires either a publicly accessible url or html. A successful response contains a temporary renderUrl and size information. This is not the same response shape as the signed image-link approach.
Runnable PHP example using cURL
<?php
$secret = getenv('URLBOX_API_SECRET');
if (!$secret) {
throw new RuntimeException('Set URLBOX_API_SECRET on the server.');
}
$payload = [
'url' => 'https://example.com',
'format' => 'png',
];
$ch = curl_init('https://api.urlbox.com/v1/render/sync');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $secret,
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR),
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 90,
]);
$responseBody = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($responseBody === false) {
$error = curl_error($ch);
curl_close($ch);
throw new RuntimeException('Urlbox request failed: ' . $error);
}
curl_close($ch);
if ($status < 200 || $status >= 300) {
throw new RuntimeException('Urlbox returned HTTP ' . $status . ': ' . $responseBody);
}
$result = json_decode($responseBody, true, 512, JSON_THROW_ON_ERROR);
if (empty($result['renderUrl'])) {
throw new RuntimeException('Urlbox response did not include renderUrl.');
}
$renderUrl = $result['renderUrl'];
echo htmlspecialchars($renderUrl, ENT_QUOTES, 'UTF-8');
This example makes a request to the current reference’s /v1/render/sync endpoint and sends the secret as a Bearer token. Adapt the format and other render options to the API’s supported parameters. The API reference documents JSON or form-encoded inputs; see Urlbox API.
Handle the returned render URL
The JSON API returns a URL that expires after 30 days, according to the quickstart. If the application needs the output beyond that window, download it to storage you control or configure supported cloud storage rather than treating the temporary URL as permanent. Use your application’s normal access controls when making stored screenshots available to users.
Choose full-page, faster, or element capture
For capture options and their behavior, consult the Urlbox screenshot documentation. The right mode depends on whether you need lazy-loaded content, speed, or a specific component rather than the whole page.
Full-page screenshots
- Set
full_page: trueto capture the full page. - By default, Urlbox scrolls down the page before capture to trigger lazy-loaded content and measure page height. This prioritizes accuracy but can take longer.
skip_scroll: trueavoids that initial scrolling behavior and may reduce render time, but content that only appears after scrolling may not load.- The documented
stitchmode scrolls and combines page sections to support more layouts. Thenativemode uses browser-native full-page capture; it is faster but can fail on some sites. - Use
full_widthwhere a page scrolls horizontally.
Capture one element
Set selector to a CSS selector when you want a specific element rather than the full page. Ensure the selector matches the rendered page and allow enough time for the element to appear; a selector that does not exist on the requested page cannot provide the intended element capture.
Free tools Windows power users keep installed
One-click scans. No signup required.
Pick an output format with size limits in mind
The screenshot documentation lists maximum dimensions of 65,535 by 65,535 for JPEG and 16,383 by 16,383 for WebP. It recommends PNG for full-page captures without those size limits. Choose the format based on your output dimensions and the trade-off between compatibility, file size, and image quality; verify current limits in the live documentation.
Rank #4
Plan for India: billing, tax, and operating costs
Urlbox’s pricing page lists plans in US dollars and states that prices exclude VAT at the prevailing rate. It does not establish India-specific INR pricing, GST treatment, local payment availability, or what tax obligations apply to an individual buyer or business. Confirm applicable terms with Urlbox and your tax adviser rather than treating the listed plan price as an India-specific quote. Check the live Urlbox pricing page before budgeting, since prices and plan terms can change.
| Plan listed on Urlbox pricing page | Listed monthly price | Listed render allowance or basis |
|---|---|---|
| Lo-Fi | $19/month | Up to 2,000 renders |
| Hi-Fi | $49/month | Up to 5,000 renders |
| Ultra | $99/month | Up to 15,000 renders |
| Business | $498/month | $495 base plus $3 per 1,000 renders |
| Enterprise | From $3,000/month | Not stated on the pricing page figures cited here |
These are the values listed on Urlbox’s pricing page at the time of writing, not an India-specific quote. Estimate expected render volume and confirm current plan limits and any applicable taxes directly before selecting a plan.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common integration failures
- Composer cannot find the class: Confirm the package installation succeeded, that
vendor/autoload.phpis required, and that the import matches the official sample:UrlboxScreenshotsUrlbox. - Signed link fails after changing options: The signature covers the query options. Regenerate the URL after changing options; do not edit a signed URL’s parameters after generation.
- API returns an authentication error: For
POST /v1/render/sync, send the project secret inAuthorization: Bearer .... Do not copy the legacy/v1/renderpage’s HTTP Basic instructions onto this endpoint. - API rejects the render request: Check that the payload contains a publicly accessible
urlor anhtmlinput and that options are encoded as JSON or form data as intended. - The screenshot is incomplete: For lazy-loaded pages, keep the default scroll behavior and use stitch mode where appropriate. If speed is more important and the page works with native capture, try
native; otherwise return to the more reliable stitched approach. - A full-page output is too large: Consider PNG for dimensions beyond the documented JPEG or WebP maxima, reduce the capture dimensions, or capture a narrower CSS-selected element.
- A stored link no longer works: The JSON API’s
renderUrlis temporary and expires after 30 days. Download the result or configure storage if longer retention is required.
Or skip the browser setup
ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. Its clean-shot flow accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in headers.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Example cURL request (see the ScreenshotNeo API documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo also has the MCP tools take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Its Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.
Frequently Asked Questions
Does Urlbox’s PHP example require Laravel?
The official PHP sample documents the Composer package and client usage, but does not state Laravel compatibility or a Laravel-specific integration.
Can I use an HTML string instead of a public webpage URL?
The JSON API reference accepts either a publicly accessible URL or HTML as input.
Which Urlbox endpoint should I use with Bearer authentication?
The current API reference documents Bearer authentication for POST /v1/render/sync; the separate legacy POST API page describes different authentication for /v1/render.
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.




