# searchpro/4.1.16/api/request_cache.php

BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS &amp; JavaScript, version 4.1.16. 45 lines.

- Page: https://pluginprobe.com/plugins/searchpro/4.1.16/code/api/request_cache.php
- Raw: https://pluginprobe.com/plugins/searchpro/4.1.16/raw/api/request_cache.php
- Modified: 2026-09-11T16:22:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/searchpro/4.1.16/code/api/request_cache.php#L10-L20`.

```php
<?php

if (!defined('ABSPATH')) exit;

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_GET['berqwp_request_cache']) && !empty($_POST['page_slug']) && !empty($_POST['page_url'])) {
    
    if (defined('DOING_CRON') && DOING_CRON) {
        return;
    }

    if (defined('DOING_AJAX') && DOING_AJAX) {
        return;
    }

    if (defined('REST_REQUEST') && REST_REQUEST) {
        return;
    }

    // Allow only requests from the same site
    $origin  = $_SERVER['HTTP_ORIGIN'] ?? '';
    $referer = $_SERVER['HTTP_REFERER'] ?? '';

    $site_url = home_url();

    if (empty($origin) || empty($referer)) {
        wp_send_json_error(['status' => 'forbidden', 'message' => 'Unauthorized request.'], 403);
        exit;
    }

    if ((!empty($origin) && strpos($origin, $site_url) !== 0) || 
        (!empty($referer) && strpos($referer, $site_url) !== 0)) {
        wp_send_json_error(['status' => 'forbidden', 'message' => 'Unauthorized request.'], 403);
        exit;
    }

    $path = sanitize_text_field(wp_unslash($_POST['page_slug']));
    $page_url = esc_url_raw(wp_unslash($_POST['page_url']));

    if (bwp_can_warmup_cache($page_url)) {
        warmup_cache_by_url($page_url);
        echo wp_json_encode(['status' => 'success']);
    }
    
    exit;
}
```
