douyou7797 2016-06-20 06:47
浏览 43

无法打开套接字 - ReCAPTCHA

Overview: I got DDOSed recently and implemented a firewall with rules as an additional countermeasure for preventing this sort of thing from happening again. I portforwarded and everything seems to work fine now: here's my website -> http://dynastyms.net

Problem: The reCAPTCHA seems to have stopped working. It says the socket has failed. When I try to register, it tells me that the socket was not open. This sort of issue did not occur when I did not have my firewall up.

Here is the code and the line that is printed when the socket connection fails.

function _recaptcha_http_post($host, $path, $data, $port = 80) {

        $req = _recaptcha_qsencode ($data);

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

        $response = '';
        if( false == ( $fs = @fsockopen($host, 8080, $errno, $errstr, 10) ) ) {
                die ('Could not open socket');
        }

        fwrite($fs, $http_request);

        while ( !feof($fs) )
                $response .= fgets($fs, 1160); // One TCP-IP packet
        fclose($fs);
        $response = explode("

", $response, 2);

        return $response;
}

I get the "could not open socket" error. Not sure what to do here. My port 8080 is open as well.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 写uniapp时遇到的问题
    • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
    • ¥15 找一个网络防御专家,外包的
    • ¥100 能不能让两张不同的图片md5值一样,(有尝)
    • ¥15 informer代码训练自己的数据集,改参数怎么改
    • ¥15 请看一下,学校实验要求,我需要具体代码
    • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
    • ¥20 MATLAB绘制两隐函数曲面的交线
    • ¥15 求TYPCE母转母转接头24PIN线路板图
    • ¥100 国外网络搭建,有偿交流