-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
37 lines (32 loc) · 850 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* Cloudflare API online document: http://www.cloudflare.com/docs/client-api.html
*/
$serverUri = "https://www.cloudflare.com/api_json.htm";
$APIKey = "YOUR_API_KEY";
$email = "YOUR_CLOUDFLARE_LOGIN_EMAIL";
$domain = "DOMAIN_YOU_WANT_TO_PURGE";
$data['a'] = 'fpurge_ts';
$data['tkn'] = $APIKey;
$data['email'] = $email;
$data['z'] = $domain;
$data['v'] = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $serverUri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
$result = curl_exec($ch);
if($result == false)
{
echo "cURL error message: ".curl_error($ch);
echo "<br />Send data<br /><pre>";
print_r($data);
echo "</pre>";
}
else
{
echo "Purge data successful.";
}
curl_close($ch);