Hi,
something like this
if ( defined( 'LSCWP_V' ) ) {
do_action('litespeed_purge_url', 'https://www.mywebsite.com/');
}
$url = 'https://www.mywebsite.com/';
$headers = array(
"Host: www.mywebsite.com",
"Accept: */*,image/webp"
);
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_GET, true);
curl_setopt( $ch, CURLOPT_HEADER, true);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36");
curl_setopt( $ch, CURLOPT_VERBOSE, true);
curl_setopt( $ch, CURLOPT_ENCODING, "");
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_exec( $ch );
if you have enable mobile cache and webp support , you will need to run curl 4 times with different user agent and webp support
1. desktop + no-webp –> this one can be omitted though
2. desktop + webp
3. mobile + no-webp
4. mobile + webp
you need to copy paste the user agent and “accept” header from these browsers to mimic the access
Best regards,