You are here

public function Socket::fsockopen in reCAPTCHA 8.2

Same name and namespace in other branches
  1. 6.2 recaptcha-php/src/ReCaptcha/RequestMethod/Socket.php \ReCaptcha\RequestMethod\Socket::fsockopen()
  2. 7.2 recaptcha-php/src/ReCaptcha/RequestMethod/Socket.php \ReCaptcha\RequestMethod\Socket::fsockopen()

fsockopen

Parameters

string $hostname:

int $port:

int $errno:

string $errstr:

float $timeout:

Return value

resource

See also

http://php.net/fsockopen

File

recaptcha-php/src/ReCaptcha/RequestMethod/Socket.php, line 48

Class

Socket
Convenience wrapper around native socket and file functions to allow for mocking.

Namespace

ReCaptcha\RequestMethod

Code

public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) {
  $this->handle = fsockopen($hostname, $port, $errno, $errstr, is_null($timeout) ? ini_get("default_socket_timeout") : $timeout);
  if ($this->handle != false && $errno === 0 && $errstr === '') {
    return $this->handle;
  }
  return false;
}