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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use PhantomJS’s page.onResourceReceived callback. It runs when a resource response arrives and exposes the response URL, status, status text, headers, content type, redirect target, body size and processing stage. Filter the callback to the API or asset you need, and account for multi-part responses before treating an event as complete.

This is legacy-maintenance guidance: PhantomJS development is suspended, PhantomJS 2.1 was released on January 23, 2016, and 2.1.1 remains the last known stable release. It is suitable for understanding or safely maintaining an existing script; evaluate a maintained browser-automation stack for new production work.

Minimal response-header interception

Create a webpage, assign onResourceReceived, filter by URL, and read response.headers. The callback also receives metadata useful for diagnosing redirects and failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
var page = require('webpage').create();

page.onResourceReceived = function (response) {
  if (response.url.indexOf('api.example.com') === 0) {
    console.log('status: ' + response.status);
    console.log('statusText: ' + response.statusText);
    console.log('headers: ' + JSON.stringify(response.headers));
  }
};

page.open('https://example.com', function (status) {
  console.log('page status: ' + status);
  phantom.exit();
});

Run the script with the PhantomJS binary. The callback will also see stylesheets, images, scripts, fonts and other subresources, so the URL test is important. Without it, a normal page can produce a large amount of output.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works

What onResourceReceived provides

A received-resource object can include:

  • url: the URL PhantomJS associates with the resource.
  • status and statusText: the HTTP result and its text description.
  • headers: the response-header collection you want to inspect.
  • contentType: the reported media type.
  • redirectURL: a redirect destination when one is exposed.
  • bodySize: the reported response size.
  • stage: the point in processing represented by this callback, commonly start or end.
  • id: an identifier you can use to correlate events for the same resource.

Header names and values are supplied by the browser engine. If a header is absent, treat it as absent; do not substitute a value from the outgoing request or assume that a redirect’s headers are the final URL’s headers.

Handle multi-part responses correctly

Large responses can trigger more than one onResourceReceived invocation. If you log every invocation as a complete response, you can report duplicates or capture timing and body information too early. Inspect response.stage and keep state keyed by response.id.

var page = require('webpage').create();
var resources = {};

page.onResourceReceived = function (response) {
  if (response.url.indexOf('api.example.com') !== 0) {
    return;
  }

  var item = resources[response.id] || {
    url: response.url,
    headers: null,
    status: null,
    statusText: null,
    started: false,
    ended: false
  };

  if (response.stage === 'start') {
    item.started = true;
    item.headers = response.headers;
    item.status = response.status;
    item.statusText = response.statusText;
  }

  if (response.stage === 'end') {
    item.ended = true;
    item.bodySize = response.bodySize;
    item.contentType = response.contentType;
    item.redirectURL = response.redirectURL;
    console.log(JSON.stringify(item));
    delete resources[response.id];
  }

  resources[response.id] = item;
};

page.open('https://example.com', function (status) {
  console.log('page status: ' + status);
  phantom.exit();
});

Not every response necessarily exposes both stages. Store what is available, tolerate a missing stage, and use a timeout or page-finished path to flush entries that never receive the event you expected.

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

Filter the traffic you actually need

Match an exact host or path

String-prefix matching is simple, but make the boundary explicit when several hosts share a name:

function isTarget(url) {
  return url.indexOf('https://api.example.com/v2/') === 0;
}

page.onResourceReceived = function (response) {
  if (!isTarget(response.url)) return;
  console.log(response.status + ' ' + response.url);
  console.log(JSON.stringify(response.headers));
};

For a small script, this avoids adding a URL parser. For broader matching, normalize the URL first and compare its host, path and query components deliberately. Do not accidentally match https://api.example.com.evil.test/ when you intended one host.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Filter by resource behavior

Use the URL and the metadata exposed by the callback to distinguish an API response from a document, image or stylesheet. Log status, statusText and contentType together with headers so a redirect, error page or non-JSON response is visible instead of being mistaken for the expected API result.

Keep logging bounded

Header values can contain tokens and personal data. Restrict logging to the fields needed for debugging, redact authorization or cookie values before writing files, and remove the interceptor after the diagnostic run if the page object is reused.

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

Request headers versus response headers

These hooks operate in opposite directions:

Need PhantomJS API What you read or change
Inspect what the server sent page.onResourceReceived Read response.headers, status, URL and response metadata.
Inspect or alter what PhantomJS sends page.onResourceRequested Read requestData.headers; use the networkRequest object to set a header, abort a request or change its URL.

Do not use customHeaders or onResourceRequested to discover response headers. They concern outgoing requests. A request header that you supplied is not evidence that the server returned the same value.

Redirects, subresources and page completion

Redirect chains

A navigation can generate several resources: the original URL, one or more redirects and the final document. Record each matching URL and its status. Use redirectURL when available, but do not collapse records solely by the final URL; headers can differ at each hop.

Subresources

Scripts, XHR or fetch requests, images, fonts and stylesheets can all generate received-resource events. A page-level status only describes the navigation, not every dependency. If you need an API response, match its URL rather than assuming the last callback belongs to the page.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Do not exit too early

page.open reports the navigation result, but asynchronous requests may still be in flight. If the target call is initiated by page JavaScript, wait for a known condition or a bounded delay before calling phantom.exit(). In production maintenance code, combine a deadline with a completion flag so a hung request cannot keep the process alive indefinitely.

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.

A diagnostic script with timeout and redaction

This example records only selected headers, handles either stage, and exits after a fixed window. Adjust the target and timeout for your page.

var page = require('webpage').create();
var targetPrefix = 'https://api.example.com/';
var seen = {};
var finished = false;

function safeHeaders(headers) {
  var result = {};
  for (var i = 0; i < headers.length; i++) {
    var name = String(headers[i].name).toLowerCase();
    if (name === 'set-cookie' || name === 'authorization' || name === 'cookie') {
      result[name] = '[redacted]';
    } else {
      result[name] = headers[i].value;
    }
  }
  return result;
}

page.onResourceReceived = function (response) {
  if (response.url.indexOf(targetPrefix) !== 0) return;

  var record = seen[response.id] || { url: response.url };
  if (response.stage === 'start') {
    record.status = response.status;
    record.statusText = response.statusText;
    record.headers = safeHeaders(response.headers || []);
  }
  if (response.stage === 'end') {
    record.bodySize = response.bodySize;
    record.contentType = response.contentType;
    record.redirectURL = response.redirectURL;
    console.log(JSON.stringify(record));
    delete seen[response.id];
  } else {
    seen[response.id] = record;
  }
};

page.open('https://example.com', function (status) {
  console.log('navigation: ' + status);
  window.setTimeout(function () {
    if (!finished) {
      finished = true;
      phantom.exit();
    }
  }, 10000);
});

The script is intentionally defensive: it does not assume headers are present, it redacts common secrets, and it has a bounded lifetime. For a real application, replace the fixed delay with a page-side signal or another condition that proves the target request completed.

Common failures and fixes

No header output

  • Confirm the callback is attached to the same page object passed to page.open.
  • Temporarily log every URL to verify that your prefix matches the actual URL, including scheme, host, path and redirects.
  • Check that the target request really occurs during the page lifetime; a later click or timer may require an explicit wait.

Only the document appears

You may be inspecting the navigation callback rather than resource events, or exiting before an XHR completes. Keep onResourceReceived installed and delay exit until the target response or deadline.

Duplicate records

Large responses can be delivered in multiple callbacks. Group by response.id and use stage; treat end as the completion point when it exists.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)

The status is an error or a redirect

Log statusText, redirectURL and the URL for every matching event. A redirect is not the same response as the final resource, and a server error may return headers even when the page code fails.

A header seems missing

Header visibility depends on what the PhantomJS engine exposes for that response and stage. Check the relevant redirect and the final resource separately. Never infer a missing response header from request headers.

Hosted execution behaves differently

PhantomJsCloud documents a related distinction: primary-resource headers are exposed on the page response, while other resources are exposed through resourceReceived events. When moving a local script to a hosted API, map your logic to the provider’s page-level and resource-level response fields.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability, security and maintenance considerations

Intercepting headers is observational; it does not make an unreliable page reliable. Set a navigation and application-level deadline, retain status and URL context, and treat missing stages as normal possibilities. Avoid printing cookies, authorization values or personal data to shared logs. If you persist records, protect them like the responses they describe.

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

PhantomJS’s browser engine is old and its development is suspended. PhantomJS 2.1.1 is identified by the project’s archival notice as the last known stable release. That status affects modern TLS, JavaScript, site compatibility and security maintenance. Keep this technique for legacy jobs that you must support, pin the binary and test it against representative redirects and subresources. For new systems, compare a maintained automation stack on response-header visibility, request interception controls, redirect handling, current browser-engine behavior and whether a hosted service is available.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video

Or skip the browser setup

If your actual goal is a clean image or PDF of a URL rather than low-level response inspection, ScreenshotNeo provides a single HTTP request. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; those steps can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and each response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server supplies take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

See the ScreenshotNeo documentation for parameters and response details. The same endpoint accepts the common parameter names used by other screenshot APIs, which can simplify a migration.

cURL

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

Python

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)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper and page controls, HTML/CSS rendering, custom JavaScript and CSS, pre-capture clicks, selector hiding, waits, request and resource blocking, custom headers and cookies, user-agent, authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Every feature is on every plan. The Free plan includes 1,000 shots each month without a card; paid plans start at $5 for 3,000 shots, with yearly billing providing two months free. Start with the free ScreenshotNeo account.

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

Frequently Asked Questions

Can PhantomJS read headers from an XHR or API request?

Yes. XHR and other subresources generate resource events; match the API URL in onResourceReceived and read response.headers.

Should I process a response on the start or end stage?

Capture headers on start when available, and finalize size, content type and timing-related data on end. Keep the record tolerant of responses that expose only one stage.

Does this method modify response headers?

No. It observes incoming response metadata. Use onResourceRequested and its networkRequest controls for outgoing-request changes.

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.90
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99

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.

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