şu şekilde değiştirebilirsiniz, önceki mesajdaki listRules fonksiyonunu eğer id leri biliyorsanız buna eklemenize gerek yok.

<?php

// Cloudflare API kimlik bilgileri
$apiKey = 'YOUR_API_KEY';
$email = 'YOUR_EMAIL';
$zoneId = 'YOUR_ZONE_ID';

// Kural durumunu değiştirme fonksiyonu
function changeRuleStatus($apiKey, $email, $zoneId, $ruleId, $status = 'disabled') {
    // CURL başlat
    $ch = curl_init("https://api.cloudflare.com/client/v4/zones/{$zoneId}/firewall/rules/{$ruleId}");
    
    // İstek verisi
    $data = json_encode(['status' => $status]);
    
    // CURL ayarları
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "X-Auth-Email: {$email}",
        "X-Auth-Key: {$apiKey}",
        "Content-Type: application/json"
    ]);

    // İsteği gönder
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    // CURL hata kontrolü
    if(curl_errno($ch)) {
        echo "CURL Hatası: " . curl_error($ch) . "\n";
        curl_close($ch);
        return;
    }
    curl_close($ch);

    // Yanıtı işle
    $result = json_decode($response, true);
    
    if ($httpCode == 200 && $result['success']) {
        $statusText = $status == 'active' ? 'aktif' : 'pasif';
        echo "Kural başarıyla {$statusText} edildi.\n";
    } else {
        echo "Hata oluştu (HTTP Kodu: $httpCode):\n";
        print_r($result['errors'] ?? 'Bilinmeyen hata');
    }
}

// Kullanım örnekleri:

// Kuralı pasif et
// changeRuleStatus($apiKey, $email, $zoneId, 'KURAL_ID', 'disabled');

// Kuralı aktif et
// changeRuleStatus($apiKey, $email, $zoneId, 'KURAL_ID', 'active');