cloudflareye php ile domain ekletiyoruz lakin always use https aktif olmuyor bunun aktif olarak gelmesini istiyoruz bütçemiz 250 tl çözebilcek arkadaşlar dm
<?php
$api_key = 'xx';
$email = 'xxx@gmail.com';
$zone_id = 'xxxx';
$domain_name = 'domain.site';
$data = [
'name' => $domain_name,
'jump_start' => true,
'type' => 'full',
'settings' => [
'always_use_https' => true,
],
];
$ch = curl_init("https://api.cloudflare.com/client/v4/zones");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-Auth-Email: {$email}",
"X-Auth-Key: {$api_key}",
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo 'Alan adı Cloudflare\'e başarıyla eklendi!';
} else {
echo 'Bir hata oluştu: ' . $result['errors'][0]['message'];
}
?>