src/BW/Captcha/Recaptcha.php
protected function httpPost($host, $path, array $data, $port = 80) {
        $req = $this->qsencode($data);

        $http_request  = "POST {$path} HTTP/1.0\r\n";
        $http_request .= "Host: {$host}\r\n";
        $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
        $http_request .= "Content-Length: " . strlen($req) . "\r\n";
        $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
        $http_request .= "\r\n";
        $http_request .= $req;

        $response = '';
        if(false == ($fs = @fsockopen($host, (int)$port, $errno, $errstr, 10))) {
            throw new \Exception('Could not open socket');
        }

        fwrite($fs, $http_request);
        while ( ! feof($fs)) {
            $response .= fgets($fs, 1160); // One TCP-IP packet
        }
        fclose($fs);

        $response = explode("\r\n\r\n", $response, 2);
        return $response;
    }
protected function httpPost($host, $path, array $data, $port = 80) {
        $req = $this->qsencode($data);

        $http_request  = "POST {$path} HTTP/1.0\r\n";
        $http_request .= "Host: {$host}\r\n";
        $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
        $http_request .= "Content-Length: " . strlen($req) . "\r\n";
        $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
        $http_request .= "\r\n";
        $http_request .= $req;

        $response = '';
        if(false == ($fs = @fsockopen($host, (int)$port, $errno, $errstr, 10))) {
            throw new \Exception('Could not open socket');
        }

        fwrite($fs, $http_request);
        while ( ! feof($fs)) {
            $response .= fgets($fs, 1160); // One TCP-IP packet
        }
        fclose($fs);

        $response = explode("\r\n\r\n", $response, 2);
        return $response;
    }
Submits an HTTP POST to a reCAPTCHA server

@param string $host
@param string $path
@param array $data
@param int port
@return array response
@throws \Exception