private function httpPost($host, $path, $data, $port = 80)
    {
        $req = $this->getQSEncode($data);

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

        $response = null;
        if (!$fs = fsockopen($host, $port, $errno, $errstr, 10)) {
            throw new ValidatorException('Could not open socket');
        }

        fwrite($fs, $httpRequest);

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

        fclose($fs);

        $response = explode("\r\n\r\n", $response, 2);

        return $response;
    }
private function httpPost($host, $path, $data, $port = 80)
    {
        $req = $this->getQSEncode($data);

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

        $response = null;
        if (!$fs = fsockopen($host, $port, $errno, $errstr, 10)) {
            throw new ValidatorException('Could not open socket');
        }

        fwrite($fs, $httpRequest);

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

        fclose($fs);

        $response = explode("\r\n\r\n", $response, 2);

        return $response;
    }
private function httpPost ( $ host , $ path , $ data , $ port = 80 ) { $ req = $ this -> getQSEncode ( $ data ) ; $ httpRequest = "POST $path HTTP/1.0\r\n" ; $ httpRequest .= "Host: $host\r\n" ; $ httpRequest .= "Content-Type: application/x-www-form-urlencoded;\r\n" ; $ httpRequest .= "Content-Length: " . strlen ( $ req ) . "\r\n" ; $ httpRequest .= "User-Agent: reCAPTCHA/PHP\r\n" ; $ httpRequest .= "\r\n" ; $ httpRequest .= $ req ; $ response = null ; if ( ! $ fs = fsockopen ( $ host , $ port , $ errno , $ errstr , 10 ) ) { throw new ValidatorException ( 'Could not open socket' ) ; } fwrite ( $ fs , $ httpRequest ) ; 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
Submits an HTTP POST to a reCAPTCHA server