ScreenshotNeo

BlogHow-to

How to Fix GrabzIt API Errors in a PHP Website Hosted in India

Diagnose GrabzIt PHP errors by code, then check credentials, host network access, asynchronous status, and local file permissions.

By the ScreenshotNeo team4 October 20267 min read

Start with the exact GrabzItException code, the operation that failed, and sanitized request details. In GrabzIt’s PHP API, the exception code maps to a documented error, so use it to choose the next check instead of parsing the human-readable message. The documented timeout guidance points to a possible host firewall or network configuration issue; it does not establish a special India-wide API defect or configuration.

1. Capture the exception code and failing operation

Catch \\GrabzIt\\GrabzItException around the operation that fails. Record the error code, operation, target URL, and relevant non-secret options. Do not log your application key, secret, authorization headers, or cookies.

<?php
try {
    // Replace this with the GrabzIt operation that fails.
    $grabzIt->URLToImage('https://example.com');
    $grabzIt->SaveTo(__DIR__ . '/results/example.png');
} catch (\\GrabzIt\\GrabzItException $e) {
    error_log(sprintf(
        'GrabzIt operation failed: code=%s message=%s',
        $e->getCode(),
        $e->getMessage()
    ));
}

Keep the exception code as the primary diagnostic clue. GrabzIt’s example branches on a named constant, such as PARAMETER_NO_URL; check the current reference for the exact constant and description before acting.

Use the code family to choose a branch

Code range Documented category First checks
100–199 Mostly parameter or configuration errors URL, key, signature, format, country code, callback URL, capture options, and other required inputs
200–202 Server or network categories Service availability, outbound connectivity, firewall or network configuration
300–301 Rendering or missing screenshot Target page behavior, capture options, and returned status or message
400 Generic error Preserve the full code and message, then inspect operation and status
500 Upgrade required Check whether the requested feature requires an account upgrade
600–601 File-save error or missing path Destination path and PHP filesystem permissions

This is a quick grouping of the official error lookup table, not a substitute for checking the exact error there. GrabzIt exception codes.

2. Check credentials, inputs, and deployment URLs

  1. Confirm the application key and secret belong to the intended GrabzIt application and environment. Replace any demo placeholders with the application credentials.
  2. Check the capture URL and all required options for missing or malformed values. If the code identifies a parameter error, correct that parameter before investigating the network.
  3. If a remotely hosted demo or callback flow is involved, verify that the handler URL points to the publicly accessible location of GrabzItHandler.php. A local-only or incorrect URL cannot serve as a reachable public handler.
  4. Keep secrets out of source control and diagnostic logs. Log whether a credential is configured, not its value.

GrabzIt documents both its PHP SDK and direct REST requests. As a diagnostic inference, if a direct REST call from the same server succeeds while the SDK path fails, focus on SDK integration and configuration. If both fail, credentials, URL, and outbound connectivity remain in scope; this comparison alone does not prove the cause. See the GrabzIt API documentation and PHP API documentation.

3. Diagnose a GrabzIt API timeout from the hosting server

When all requests time out, GrabzIt says a host firewall or network configuration issue is a likely cause and recommends asking the web host whether api.grabz.it is blocked. This is a host-level possibility to verify with the provider serving your website. The cited guidance does not identify a country-level block or a distinct India routing problem.

  1. Confirm the timeout occurs from the website’s hosting environment, not only from a developer’s laptop.
  2. Give the host the hostname api.grabz.it, the time window, and the observed timeout. Ask whether outbound access is blocked by a firewall, proxy, or network policy.
  3. If the provider confirms a block, ask it to permit the required outbound connection and retest from the application host.
  4. If only one capture times out, inspect the target URL and capture status as well; a single failure is not enough to conclude that the host blocks the API.

For workflows that wait for processing, use the asynchronous API approach described in GrabzIt’s documentation. Its timeout article notes that a single SaveTo call polls GrabzIt’s servers every three seconds. Avoid building a long wait loop that repeatedly calls SaveTo when the asynchronous flow is appropriate. See GrabzIt’s API timeout guidance and the PHP API reference for the supported status and result workflow.

4. Separate remote capture status from local saving

A remote capture can be processing successfully while saving the result to your server fails. The PHP reference documents GetStatus, GetResult, Save, and SaveTo. Status information includes Processing, Cached, Expired, and Message. Inspect those values to distinguish work still in progress, a ready or cached result, an expired result, or a reported processing message.

If the remote result is ready but a local write fails, check the destination directory separately:

  • Confirm the path exists, is spelled correctly, and is writable by the PHP process user.
  • Check directory ownership and read/write permissions for the application’s results directory.
  • Ensure the target filename and parent directory are valid for the hosting environment.
  • Review PHP and web-server logs for filesystem errors without exposing credentials.

GrabzIt’s PHP repository setup notes specifically call out read and write access to the results directory. See the GrabzIt PHP repository.

5. Treat SSL and proxy settings as targeted diagnostics

The PHP reference includes UseSSL($value) and SetLocalProxy($proxyUrl). Their existence does not by itself establish that either setting fixes a particular TLS error, nor provide a safe default for Indian shared hosting.

For a certificate or TLS failure, first capture the exact PHP/cURL error and ask the host to inspect the server’s CA bundle, outbound TLS inspection, and proxy or firewall configuration. These are general host-side diagnostic suggestions, not India-specific GrabzIt requirements. Do not disable TLS certificate verification as a blanket workaround. Change SSL or proxy settings only when the exact environment and API documentation support the change.

6. Direct REST diagnostic with cURL

A direct REST request can help isolate SDK setup from the server’s basic ability to reach the API. Use your actual credentials and a valid request format from the REST documentation; keep secrets out of shared logs and shell history.

curl -v --get 'https://api.grabz.it/services/convert' \\
  --data-urlencode 'key=YOUR_APPLICATION_KEY' \\
  --data-urlencode 'format=jpg' \\
  --data-urlencode 'url=https://example.com' \\
  --output capture.jpg

Use the endpoint and parameter names documented for the specific GrabzIt REST operation you are diagnosing. A request that reaches the host but returns an API error is different evidence from a connection timeout. The command is a diagnostic shape; consult the REST API reference for the required arguments and endpoint.

7. A practical troubleshooting order

  1. Record: exact exception code, message, operation, target URL, timestamp, and sanitized options.
  2. Classify: look up the precise code and follow the matching parameter, network, rendering, upgrade, or file branch.
  3. Validate inputs: confirm application credentials, URL, options, and publicly reachable handler URL where applicable.
  4. Check connectivity: for persistent timeouts, ask the actual hosting provider whether outbound requests to api.grabz.it are blocked.
  5. Inspect async state: use the documented status/result flow to tell processing, cached, expired, and message states apart.
  6. Inspect local storage: if processing succeeded but saving did not, verify the target path and PHP process permissions.
  7. Escalate with evidence: send the host or support the error code, operation, time, and sanitized request details. Never include the secret.

Or skip the browser setup

If your goal is to get a screenshot from a URL rather than diagnose a GrabzIt integration, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF; the API documentation covers the request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
  • Cookie banners are accepted and removed before capture, along with supported consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Response headers identify the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 screenshots a month with no card. Paid plans start at $5 for 3,000 screenshots. All features are on every plan.

Create a free ScreenshotNeo account and start with 1,000 screenshots a month without a card.

Performance, reliability, and cost considerations

  • Polling: repeated synchronous waiting adds API calls and time to a request. GrabzIt notes that one SaveTo call polls every three seconds; use its documented asynchronous method for workflows that wait on processing.
  • Reliability: separate upstream reachability, remote capture status, and local file writing in logs. This makes a timeout distinguishable from an expired result or permission failure.
  • Retries: do not retry every error indiscriminately. Correct invalid parameters and credentials first; investigate persistent timeouts with the host; follow the documented status/result lifecycle for processing captures.
  • Cost: the dossier does not specify GrabzIt prices or retry billing behavior, so check the current GrabzIt account and pricing terms before designing retry volume. ScreenshotNeo’s published plan facts are listed above.

FAQ

Is GrabzIt blocked in India?

The cited support guidance identifies a possible host firewall or network configuration issue. It does not establish an India-wide block. Ask your own hosting provider to verify outbound access to api.grabz.it.

Should I turn off SSL verification to fix a timeout?

No. A timeout and a certificate validation error are different symptoms. Capture the exact TLS error and ask the host to inspect its CA bundle and network path; do not disable verification as a general fix.

Why does the screenshot work but the file is missing?

The remote capture and local save are separate steps. Check the result status, destination path, and PHP process read/write permissions.

Which detail should I send to the hosting provider?

Provide the destination hostname, time of failure, exception code, operation, and sanitized error output. Do not send application secrets or private cookies.