Created
October 19, 2016 00:48
-
-
Save malwador/2f070c485f8172364bf4efd7a30f2b2c to your computer and use it in GitHub Desktop.
Simple Script in PHP to clear sucuri's cloudproxy cache via php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple Script in PHP to clear sucuri's cloudproxy cache via php | |
* | |
* Author: Salvador Aguilar | |
* Email: [email protected] | |
* Web: salrocks.com | |
*/ | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_URL => 'https://waf.sucuri.net/api?v2', | |
CURLOPT_POST => 1, | |
CURLOPT_POSTFIELDS => array( | |
// this is the Sucuri CloudProxy API key for this website | |
k => 'your-cloudproxy-api-key-goes-here', | |
// this is the Sucuri CloudProxy API secret for this website | |
s => 'your-cloudproxy-api-secret-goes-here', | |
// this is the Sucuri CloudProxy API action for this website | |
a => 'clear_cache' | |
) | |
)); | |
// Send the request & save response to $resp | |
$resp = curl_exec($curl); | |
echo '<pre>' . $resp . '</re>'; | |
// Close request to clear up some resources | |
curl_close($curl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very helpful, thank you. To use this with Godaddy's version of Sucuri, I had to set the CURLOPT_POSTFIELDS array keys as strings, e.g.: