Created
November 14, 2016 19:21
-
-
Save noeljackson/5970dfed57ffd594f5e0b8542bbc7415 to your computer and use it in GitHub Desktop.
This file contains 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 | |
$email = "[email protected]"; | |
$apikey = yourkey; | |
$zoneid = yourzone; | |
$ch = curl_init( 'https://api.cloudflare.com/client/v4/zones/' . $zoneid . '/purge_cache' ); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('purge_everything' => true)) ); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'X-Auth-Email: ' . $email, | |
'X-Auth-Key: ' . $apikey | |
)); | |
$result = curl_exec($ch); | |
if (curl_errno($ch) != 0) { | |
echo curl_errno($ch); | |
} | |
echo $result; | |
curl_close($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment