91hu

91hu

Cloudflare Turnstile [php] 使用DEMO

http://91hu.top/upload/20240527/index.php

<?php 




function curl_post($url,$postdata){
    $ch = curl_init($url);  
    curl_setopt($ch, CURLOPT_POST, 1);  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
    $response = curl_exec($ch);  
    if(curl_errno($ch)){  
        echo 'curl error: ' . curl_error($ch);  
    }  
    curl_close($ch);  
      
    // 处理响应...  
    echo $response;
}

echo "<html>
    <head>
        <script src='https://challenges.cloudflare.com/turnstile/v0/api.js'></script>
    </head>
    <body>
        <div style='    text-align: center;    margin-top: 10%;'>
            <div>test_cf_turnstile</div>
            <form action='/upload/20240527/index.php' method='POST'>
               <input type='text' name='un'  placeholder='un'/>
               <input type='password' name='pw' placeholder='pw'/>
               <div class='cf-turnstile' name='ct' data-sitekey='0x4AAAAAAAbNGaJ7jqS0RA28'></div>
               <button type='submit' value='Submit'>Log in</button>
            </form>
        </div>
       
    </body>
</html>";

echo "<div style='margin:30px'><p>post data:</p>";
print_r($_POST);
echo "</div>";

echo "<div style='margin:30px'> <p>query cf-result data:</p>";
$cf_rp=$_POST["cf-turnstile-response"];
curl_post("https://challenges.cloudflare.com/turnstile/v0/siteverify","secret=0x4AAAAAAAbNGWzdaWfOyXqXHc1LkPXXpCU&response={$cf_rp}");
echo "</div>";

echo "<div style='margin:30px'><a href='./index.html'>返回 index.html</a></div>"
?>


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

联系我 331434376    15629529961