PHP code example of fofx / api-cache
1. Go to this page and download the library: Download fofx/api-cache library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fofx / api-cache example snippets
// Create a new client instance
$client = new ScraperApiClient();
// Disable caching for a specific request
$client->setUseCache(false);
// Check current caching status
$isCachingEnabled = $client->getUseCache();
echo 'Is caching enabled: ' . ($isCachingEnabled ? 'true' : 'false') . PHP_EOL;
$response = $client->scrape('https://httpbin.org/headers');
echo format_api_response($response, true);
// Re-enable caching
$client->setUseCache(true);