-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcfaddsite.php
38 lines (33 loc) · 1.1 KB
/
cfaddsite.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
38
<?php
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);
$url = 'https://api.cloudflare.com/client/v4/zones';
$domainsList = 'name1.tld,name2.tld,namex.tld'; //List of website domains
$domains = explode(',', $domainsList);
foreach($domains as $domain) {
$bodyData= [
"name" => $domain,
"account" => [
"id" => "CloudFlareAccountID",
"name" => "CloudFlareAccountName"
],
"jump_start" => true
];
$bodyData = json_encode($bodyData);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-Auth-Email: CloudFlareAccountEmail',
'X-Auth-Key: YourCloudFlareGlobalAPI',
'Content-Type: application/json'
));
$result = curl_exec($ch);
curl_close($ch);
print_r($result); //Showing the result
echo '<br><br>';
}