-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_devmode.php
More file actions
48 lines (39 loc) · 1.17 KB
/
admin_devmode.php
File metadata and controls
48 lines (39 loc) · 1.17 KB
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
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once('init.php');
function http_fetch_url($url, $postdata, $timeout = 10, $maxredirs = 10)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_MAXREDIRS, $maxredirs);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
// Test data
$data = http_build_query(array(
'email' => $user['cloudflare'],
'tkn' => $token['cloudflare'],
'a' => 'devmode',
'z' => 'anyday-lovely.com',
// Values : 0 or 1
'v' => '0'
));
if (($content = http_fetch_url($url['cloudflare'], $data, 10)) === FALSE) {
die("Une erreur est survenue");
} else {
$obj = json_decode($content,true);
if($obj['result'] == "success")
{
var_dump($obj['response']);
echo "-- Changement effectue\n";
if($obj['response']['expires_on']) echo "--- Expires a ".date('H:i:s d/m/Y', $obj['response']['expires_on'])."\n";
}else{
echo $obj['msg'];
}
}
?>