NAME
WWW::SolveMedia - an interface to the Solve Media puzzle API
SYNOPSIS
use WWW::SolveMedia;
my $c = WWW::SolveMedia->new( 'my challenge key',
'my verification key',
'my hash key' );
# output widget
print $c->get_html();
# check answer
my $result = $c->check_answer( $ENV{REMOTE_ADDR}, $challenge, $response );
if( $result->{is_valid} ){
print "Yay!";
}else{
print "Dang it :-(";
}
DESCRIPTION
A Solve Media Puzzle can determine whether the user is a computer or human. It is typically used on websites to prevent abuse and block bots.
INTERFACE
new( ckey, vkey, hkey )
Create a new object. You need to pass in your Solve Media API keys (available for free at the Solve Media website, see below).
get_html( error_p, ssl_p, widget_opts )
Generate HTML to place on your web page.
error_p
-
If set, this will cause the Solve Media widget to display an error message.
ssl_p
-
If set, the generated html widget will use https instead of http. You should set this to match your web page, to prevent the user's browser from displaying a warning.
widget_opts
-
Optional. A reference to a hash of options for the widget. The Solve Media widget supports the following options:
theme
-
Styling theme to use. For example 'red', 'purple', 'black', 'white'.
size
-
Size of the widget. 'standard', 'small', 'medium', 'large'.
lang
-
Language to use. 'en',
See the Solve Media web site (below) for complete documentation on options.
check_answer( client_ip, challenge, answer )
After the user has filled in and submitted the form, check the answer to determine whether they are human. returns a hashref containing is_valid
and error
.
client_ip
-
the user's IP address in dotted quad format. can often be found in $ENV{REMOTE_ADDR}.
challenge
-
the puzzle challenge-id. can be found in the form field
adcopy_challenge
answer
-
the user's answer. can be found in the form field
adcopy_response
is_valid
-
boolean result.
error
-
if the user failed the test, this will contain a terse message explaining.
BUGS
There are no known bugs in the module.
SEE ALSO
http://www.solvemedia.com/
LICENSE
This software may be copied and distributed under the terms found in the Perl "Artistic License".
A copy of the "Artistic License" may be found in the standard Perl distribution.