【问题标题】:How to fetch from Google's ReCaptcha without using file_get_contents?如何在不使用 file_get_contents 的情况下从 Google 的 ReCaptcha 中获取?
【发布时间】:2018-08-09 08:59:21
【问题描述】:

我的托管服务器不允许file_get_contents。如何在不使用该调用的情况下获得 reCaptcha 的服务器验证?

    $recaptcha_secret = "";
    $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
    $responseKeys = json_decode($response,true);


    if ($responseKeys["success"]==true) {

【问题讨论】:

标签: php recaptcha


【解决方案1】:

您应该使用 Google 提供的官方 reCAPTCHA 类,它使用 cURL 并且易于使用:https://github.com/google/recaptcha

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-17
    • 1970-01-01
    • 1970-01-01
    • 2017-01-19
    • 1970-01-01
    • 2020-12-24
    相关资源
    最近更新 更多