简体   繁体   English

使用PHP / Curl的reCaptcha小部件

[英]reCaptcha Widget using PHP/Curl

I'm looking to build a small script that can load reCaptcha images from another website. 我正在寻找一个小的脚本,可以从另一个网站加载reCaptcha图像。 Seeing as the reCaptcha widget works using Javascript, is there anyway for one to capture the image generated using CURL? 看到reCaptcha小部件可以使用Javascript运作,反正有人可以捕获使用CURL生成的图像吗?

First you have to detail what exactly you want to do a bit more. 首先,您必须详细说明要执行的操作。 What is this other website you're getting the reCaptcha from? 您从哪个其他网站获得reCaptcha?

Technically, reCaptcha tokens are only valid on the domain that they're registered for. 从技术上讲,reCaptcha令牌仅在其注册的域上有效。 The reasons why are detailed here 这里详细说明原因

Signing up for a reCAPTCHA Key 注册一个reCAPTCHA密钥

In order to use reCAPTCHA, you need a public/private API key pair. 为了使用reCAPTCHA,您需要一个公共/私有API密钥对。 This key pair helps to prevent an attack where somebody hosts a reCAPTCHA on their website, collects answers from their visitors and submits the answers to your site. 此密钥对有助于防止有人在其网站上托管reCAPTCHA,从其访问者那里收集答案并将答案提交到您的网站的攻击。 You can sign up for a key on the reCAPTCHA Administration Portal. 您可以在reCAPTCHA管理门户上注册密钥。

Key Scope Your reCAPTCHA token is valid only at the domain you sign up for and any subdomains (due to the potential attack mentioned above). 关键范围reCAPTCHA令牌仅在您注册的域和任何子域中有效(由于上述潜在的攻击)。 Some users require keys for multiple sites, for example, a development server and a production server or simply multiple sites hosted on the same server. 一些用户需要用于多个站点的密钥,例如,开发服务器和生产服务器或仅托管在同一服务器上的多个站点。 Three techniques can be used to work around this: 可以使用三种技术来解决此问题:

If one of your servers is "localhost" or "127.0.0.1", reCAPTCHA will not enforce the same-domain rule. 如果您的服务器之一是“ localhost”或“ 127.0.0.1”,则reCAPTCHA将不会强制执行同域规则。 Just use the same key as for the production server. 只需使用与生产服务器相同的密钥即可。 Generate a key for a broader scope. 生成更广泛范围的密钥。 For example, if your application is a.example.com and your test server is test.corp.example.com, generate a key for example.com. 例如,如果您的应用程序是a.example.com,而测试服务器是test.corp.example.com,则为example.com生成一个密钥。 Generate a different key for each domain. 为每个域生成一个不同的密钥。

source : http://recaptcha.net/apidocs/captcha/ 来源: http : //recaptcha.net/apidocs/captcha/

This sounds like what you're trying to do, is it your server? 这听起来像是您要执行的操作,是您的服务器吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM