AsyncTcpConnection 如何连接https服务器?

0

连接以后提示 The plain HTTP request was sent to HTTPS port.

已邀请:

walkor

赞同来自:

AsyncTcpConnection不支持https

匿名用户

匿名用户

赞同来自:

牛人,有没有可能让他支持?框架非常赞啊。不支持的话始终有点遗憾

walkor

赞同来自:

https://github.com/walkor/Workerman
支持了,请更新下Workerman的代码


http://doc.workerman.net/components/workerman-http-client.html


<?php
require __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
$worker = new Worker();
$worker->onWorkerStart = function(){
$http = new Workerman\Http\Client();

$http->get('https://example.com/', function($response){
var_dump($response->getStatusCode());
echo $response->getBody();
}, function($exception){
echo $exception;
});

$http->post('https://example.com/', ['key1'=>'value1','key2'=>'value2'], function($response){
var_dump($response->getStatusCode());
echo $response->getBody();
}, function($exception){
echo $exception;
});

$http->request('https://example.com/', [
'method' => 'POST',
'version' => '1.1',
'headers' => ['Connection' => 'keep-alive'],
'data' => ['key1' => 'value1', 'key2'=>'value2'],
'success' => function ($response) {
echo $response->getBody();
},
'error' => function ($exception) {
echo $exception;
}
]);
};
Worker::runAll();
匿名用户

匿名用户

赞同来自:

非常感谢

walkor

赞同来自:

不客气

匿名用户

匿名用户

赞同来自:

已经更新

要回复问题请先登录注册