ReCaptcha\RequestMethod\SocketPost
Sends a POST request to the reCAPTCHA service, but makes use of fsockopen() instead of get_file_contents(). This is to account for people who may be on servers where allow_furl_open is disabled.
Synopsis
class SocketPost
implements
RequestMethod
{
- // constants
- const RECAPTCHA_HOST = 'www.google.com';
- const SITE_VERIFY_PATH = '/recaptcha/api/siteverify';
- const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}';
- const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}';
- // members
- private Socket $socket;
- // methods
- public void __construct()
- public string submit()
Hierarchy
Implements
Constants
Name | Value |
---|---|
RECAPTCHA_HOST | 'www.google.com' |
SITE_VERIFY_PATH | '/recaptcha/api/siteverify' |
BAD_REQUEST | '{"success": false, "error-codes": ["invalid-request"]}' |
BAD_RESPONSE | '{"success": false, "error-codes": ["invalid-response"]}' |
Members
private
- $socket
—
ReCaptcha\RequestMethod\Socket
Socket to the reCAPTCHA service
Methods
public
- __construct() — Constructor
- submit() — Submit the POST request with the specified parameters.