recaptchalib.php

Classes

ReCaptchaResponse A ReCaptchaResponse is returned from recaptcha_check_answer()

Constants

RECAPTCHA_API_SERVER

RECAPTCHA_API_SERVER

The reCAPTCHA server URL's

RECAPTCHA_API_SECURE_SERVER

RECAPTCHA_API_SECURE_SERVER

RECAPTCHA_VERIFY_SERVER

RECAPTCHA_VERIFY_SERVER

Functions

_recaptcha_qsencode()

_recaptcha_qsencode(mixed $data) : string

Encodes the given data into a query string format

Parameters

mixed $data
  • array of string elements to be encoded

Returns

string —
  • encoded request

_recaptcha_http_post()

_recaptcha_http_post(string $host, string $path, array $data,  $port) : array

Submits an HTTP POST to a reCAPTCHA server

Parameters

string $host
string $path
array $data
$port

Returns

array —

response

recaptcha_get_html()

recaptcha_get_html(string $pubkey, string $error, boolean $use_ssl) : string

Gets the challenge HTML (javascript and non-javascript version).

This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.

Parameters

string $pubkey

A public key for reCAPTCHA

string $error

The error given by reCAPTCHA (optional, default is null)

boolean $use_ssl

Should the request be made over ssl? (optional, default is false)

Returns

string —
  • The HTML to be embedded in the user's form.

recaptcha_check_answer()

recaptcha_check_answer(string $privkey, string $remoteip, string $challenge, string $response, array $extra_params) : \ReCaptchaResponse

Calls an HTTP POST function to verify if the user's guess was correct

Parameters

string $privkey
string $remoteip
string $challenge
string $response
array $extra_params

an array of extra variables to post to the server

Returns

\ReCaptchaResponse

recaptcha_get_signup_url()

recaptcha_get_signup_url(string $domain, string $appname)

gets a URL where the user can sign up for reCAPTCHA. If your application has a configuration page where you enter a key, you should provide a link using this function.

Parameters

string $domain

The domain where the page is hosted

string $appname

The name of your application

_recaptcha_aes_pad()

_recaptcha_aes_pad( $val)

Parameters

$val

_recaptcha_aes_encrypt()

_recaptcha_aes_encrypt( $val,  $ky)

Parameters

$val
$ky

_recaptcha_mailhide_urlbase64()

_recaptcha_mailhide_urlbase64( $x)

Parameters

$x

recaptcha_mailhide_url()

recaptcha_mailhide_url( $pubkey,  $privkey,  $email)

Parameters

$pubkey
$privkey
$email

_recaptcha_mailhide_email_parts()

_recaptcha_mailhide_email_parts( $email)

gets the parts of the email to expose to the user.

eg, given johndoe@example,com return ["john", "example.com"]. the email is then displayed as [email protected]

Parameters

$email

recaptcha_mailhide_html()

recaptcha_mailhide_html( $pubkey,  $privkey,  $email)

Gets html to display an email address given a public an private key.

to get a key, go to:

http://www.google.com/recaptcha/mailhide/apikey

Parameters

$pubkey
$privkey
$email