LogoLogo
Release NotesDataPipelineFAQs
PHP
PHP
  • Making Requests
    • API Endpoint Method
    • Proxy Port Method
    • SDK Method
    • Async Requests Method
      • How to use
      • Callbacks
      • API Parameters
      • Async Batch Requests
      • Decoding
    • Structured Data Collection Method
      • Amazon Product Page API
      • Amazon Search API
      • Amazon Offers API
      • Amazon Reviews API
      • Ebay Product Page API
      • Ebay Search API
      • Google SERP API
      • Google News API
      • Google Jobs API
      • Google Shopping API
      • Google Maps Search API
      • Redfin Agent Details API
      • Redfin 'For Rent' Listings API
      • Redfin 'For Sale' Listings API
      • Redfin Listing Search API
      • Walmart Search API
      • Walmart Category API
      • Walmart Product API
      • Walmart Reviews API
    • Async Structured Data Collection Method
      • Amazon Product Page API (Async)
      • Amazon Search API (Async)
      • Amazon Offers API (Async)
      • Amazon Reviews API (Async)
      • Ebay Product Page API (Async)
      • Ebay Search API (Async)
      • Google Search API (Async)
      • Google News API (Async)
      • Google Jobs API (Async)
      • Google Shopping API (Async)
      • Google Maps Search API (Async)
      • Redfin Agent Details API (Async)
      • Redfin 'For Rent' Listings API (Async)
      • Redfin 'For Sale' Listings API (Async)
      • Redfin Listing Search API (Async)
      • Walmart Search API (Async)
      • Walmart Category API (Async)
      • Walmart Product API (Async)
      • Walmart Reviews API (Async)
    • Making POST/PUT Requests
    • Customizing Requests
      • Amazon ZIP Code Targeting
      • Cached Results
      • Cost Control
      • Custom Headers
      • Device Type
      • Geotargeting
      • Geotargeting (Premium)
      • Parameters as Headers
      • Premium Residential/Mobile Proxy Pools
      • Rendering Javascript
        • Render Instruction Set
        • Screenshot Capture🆕
      • Sessions
  • Handling and Processing Responses
    • API Status Codes
    • Output Formats
      • JSON Response - Autoparse 📜
      • LLM Output Formats 💻
    • Response Encoding and Content-Type
  • Dashboard & Billing
    • API Key
    • Credit Usage
    • Delete Account
    • Invoice History
    • Billing Email
    • Billing Address
    • VAT Number
    • Payment Method
    • Cancel Subscription
  • Credits and Requests
  • Account Information
  • Documentation Overview
Powered by GitBook

Quick links

  • Homepage
  • Dashboard
  • Pricing
  • Contact Sales

Resources

  • Developer Guides
  • Blog
  • Contact Support
  • Learning Hub
On this page
  • Why is this good?
  • What's in it for you?
  • Advanced Use-Case Scenario
  • Future Enhancements

Was this helpful?

  1. Making Requests
  2. Customizing Requests

Cached Results

ScraperAPI's caching system unlocks a new level of efficiency. By leveraging advanced decision-making mechanisms, we maintain an extensive amount of cached data, that is ready to be served if called upon. When you request a page with a cached response available, you'll receive the cached data, ensuring much faster access to the information you need with a 100% success rate.

Why is this good?

  • Difficult Pages: Perfect for pages that are challenging to scrape.

  • 10-Minute Updates: No older than 10 minutes cached value.

  • Guaranteed Success: 100% success rate for cached results.

  • Faster Response Times: Retrieve data quicker from cached results.

  • Fewer Retries: Reduced number of retries needed to serve back the response.

This feature applies only to requests that include the ultra_premium=true parameter and is enabled by default.

What's in it for you?

  • 🚀Increased Efficiency: Save time and resources by reducing the need to scrape the same page multiple times.

  • ✅Improved Reliability: Enhance the reliability of your scraping tasks with consistent and timely data retrieval.

Advanced Use-Case Scenario

For cases where real-time data is required, you can ensure the API serves uncached data by adding the parameter cache_control=no-cache to the URL, as shown below:

<?php
$url =
"https://api.scraperapi.com/?api_key=APIKEY&ultra_premium=true&cache_control=no-cache&url=http://httpbin.org/ip"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,
TRUE); curl_setopt($ch, CURLOPT_HEADER,
FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,
0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
0); $response = curl_exec($ch); curl_close($ch); print_r($response);

We tag cached responses with the sa-from-cache: 1 response header, making it easy to distinguish between cached and non-cached responses.

Future Enhancements

We're always looking to improve. Stay tuned for the upcoming max_age option, which will give you even more control over your caching preferences.

Last updated 9 months ago

Was this helpful?