0
public function swooleSocket()
    {
        go(function() {
            $domain = 'tls://www.bitmex.com';
            $port = 443;
            $client = new \Swoole\Coroutine\Http\Client($domain, $port, true);

            $client->set([
                             'http_proxy_host' => '127.0.0.1',
                             'http_proxy_port' => '6666',
                         ]);


            $ret = $client->upgrade('/runtime');
            var_dump($ret);

            var_dump($client->errCode);
            var_dump(socket_strerror($client->errCode));

            if($ret)
            {
                while (true)
                {
                    $body = $client->recv();
                    var_dump($body);
                    Coroutine::sleep(0.1);
                }
            }
        });
    }

运行结果:
bool(false)
int(1)
string(23) "Operation not permitted"

6月22日提问

1 个回答

0

域名解析失败。去掉 tls:// ,注意看文档,这里不要加任何东西。

推广链接