public function SocketPost::__construct in reCAPTCHA 6.2
Same name and namespace in other branches
- 8.2 recaptcha-php/src/ReCaptcha/RequestMethod/SocketPost.php \ReCaptcha\RequestMethod\SocketPost::__construct()
- 7.2 recaptcha-php/src/ReCaptcha/RequestMethod/SocketPost.php \ReCaptcha\RequestMethod\SocketPost::__construct()
Constructor
Parameters
\ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing:
File
- recaptcha-php/
src/ ReCaptcha/ RequestMethod/ SocketPost.php, line 71
Class
- 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.
Namespace
ReCaptcha\RequestMethodCode
public function __construct(Socket $socket = null) {
if (!is_null($socket)) {
$this->socket = $socket;
}
else {
$this->socket = new Socket();
}
}