Help with purge from PHP
-
I wrote the following PHP script code to purge the entire varnish cache on our site:
// Construct Varnish Cache purge URL $scheme = parse_url( $_SERVER[HTTP_REFERER], PHP_URL_SCHEME ); $host = parse_url( $_SERVER[HTTP_REFERER], PHP_URL_HOST ); $tmpURL = $scheme . "://" . $host . "/?vhp_flush_all=1" ; $purgeURL = wp_nonce_url( $tmpURL, 'vhp-flush-all') ; // Do the purge file_get_contents( $purgeURL );
This code was working fine but recently I am getting the following error when it executes –
Warning: file_get_contents(https://www.n1fd.org/?vhp_flush_all=1&_wpnonce=a44652dfad): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in …If I execute the same URL from by browser, the purge works fine. I am obviously doing something wrong here – can you help me to understand how to correctly purge the varnish cache from PHP?
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Help with purge from PHP’ is closed to new replies.