Php Koru Api Entegrasyon Hk. - R10.net
  • 16-10-2020, 22:05:28
    #1
    Selam Arkadaşlar,

    Formdan gelen veri ile kodları şifrelemek istiyorum

    Bunu nasıl yapabilirim.


    <?php
    
    function phpkoru_basit_encode($apikey, $code, $enc_strength = 1, $lic_domain = "", $lic_ip = "") {
        $URL = "https://api.phpkoru.com/basit/encode";
        
        $post_fields = ["apikey" => $apikey, "code" => $code, "encryption_strength" => $enc_strength, "lic_domain" => $lic_domain, "lic_ip" => $lic_ip];
        unset($apikey, $code, $enc_strength, $lic_domain, $lic_ip);
    
        $ch = curl_init($URL);
        unset($URL);
        curl_setopt($ch, CURLOPT_MUTE, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
        unset($post_fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        unset($ch);
    
        if ($http_code === 200)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 200)
                return $result;
            else
                return false;
        }
        else if ($http_code === 403)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 403)
                return $result;
            else
                return false;
        }
        else if ($http_code === 500)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 500)
                return $result;
            else
                return false;
        }
        else
            return false;
        unset($result, $http_code);
    }
    
    $apikey = ""; // Api key
    $code = "<?php\necho \"Lala\";\n?>"; // Code
    $enc_strength = 1; // Must be between 1-8
    $lic_domain = ""; // Not required
    $lic_ip = ""; // Not required
    
    $phpkoru_basit_data = phpkoru_basit_encode($apikey, $code, $enc_strength, $lic_domain, $lic_ip);
    
    if ($phpkoru_basit_data !== false)
    {
        header("Content-Type: text/plain; charset=utf-8");
        if ($phpkoru_basit_data["status"] !== 200)
            echo "Error: ".$phpkoru_basit_data["message"];
        else
            echo base64_decode($phpkoru_basit_data["data"]["encoded_code"]);
    }
    else
        echo "Something's wrong somewhere.";
    unset($apikey, $code, $enc_strength, $lic_domain, $lic_ip, $phpkoru_basit_data);
    
    ?>
    Geunes İnternet Hizmetleri - Yerel Seo Hizmeti
  • 17-10-2020, 02:20:53
    #2
    Geunes adlı üyeden alıntı
    Selam Arkadaşlar,

    Formdan gelen veri ile kodları şifrelemek istiyorum

    Bunu nasıl yapabilirim.


    <?php
    
    function phpkoru_basit_encode($apikey, $code, $enc_strength = 1, $lic_domain = "", $lic_ip = "") {
        $URL = "https://api.phpkoru.com/basit/encode";
        
        $post_fields = ["apikey" => $apikey, "code" => $code, "encryption_strength" => $enc_strength, "lic_domain" => $lic_domain, "lic_ip" => $lic_ip];
        unset($apikey, $code, $enc_strength, $lic_domain, $lic_ip);
    
        $ch = curl_init($URL);
        unset($URL);
        curl_setopt($ch, CURLOPT_MUTE, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
        unset($post_fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        unset($ch);
    
        if ($http_code === 200)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 200)
                return $result;
            else
                return false;
        }
        else if ($http_code === 403)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 403)
                return $result;
            else
                return false;
        }
        else if ($http_code === 500)
        {
            $result = json_decode($result, true);
            if ($result["status"] === 500)
                return $result;
            else
                return false;
        }
        else
            return false;
        unset($result, $http_code);
    }
    
    $apikey = ""; // Api key
    $code = "<?php\necho \"Lala\";\n?>"; // Code
    $enc_strength = 1; // Must be between 1-8
    $lic_domain = ""; // Not required
    $lic_ip = ""; // Not required
    
    $phpkoru_basit_data = phpkoru_basit_encode($apikey, $code, $enc_strength, $lic_domain, $lic_ip);
    
    if ($phpkoru_basit_data !== false)
    {
        header("Content-Type: text/plain; charset=utf-8");
        if ($phpkoru_basit_data["status"] !== 200)
            echo "Error: ".$phpkoru_basit_data["message"];
        else
            echo base64_decode($phpkoru_basit_data["data"]["encoded_code"]);
    }
    else
        echo "Something's wrong somewhere.";
    unset($apikey, $code, $enc_strength, $lic_domain, $lic_ip, $phpkoru_basit_data);
    
    ?>
    ücretiyle yardımcı olabilirim
    𝗪𝗘 ❤ 𝐆𝐎𝐎𝐆𝐋𝐄 - is-reh.net