Swoole v4.6.4 is released with multiple enhancements and bug fixes.
Example of Coroutine\Http::get
:
<?php
use function Swoole\Coroutine\Http\get;
use function Swoole\Coroutine\Http\post;
Co\run(function() {
$data = get('http://httpbin.org/get?hello=world');
$body = json_decode($data->getBody());
var_dump($body);
});
Example of Coroutine\Http::post
:
<?php
use function Swoole\Coroutine\Http\get;
use function Swoole\Coroutine\Http\post;
Co\run(function() {
$random_data = base64_encode(random_bytes(128));
$data = post('http://httpbin.org/post?hello=world', ['random_data' => $random_data]);
$body = json_decode($data->getBody());
var_dump($body);
});
New API
---
+ Added Coroutine\Http::request, Coroutine\Http::post, Coroutine\Http::get (swoole/library#97) (@matyhtf)
Enhancement
---
+ Supported ARM 64 build (#4057) (@devnexen)
+ Supported set open_http_protocol in Swoole TCP Server (#4063) (@matyhtf)
+ Supported ssl client only set certificate (swoole/swoole-src@91704ac) (@matyhtf)
+ Supported ssl client only set certificate (swoole/swoole-src@91704ac) (@matyhtf)
+ Supported tcp_defer_accept option for FreeBSD (#4049) (@devnexen)
Fixed
---
* Fixed Proxy-Authorization missing when use Coroutine\Http\Client (swoole/swoole-src@edc0552) (@matyhtf)
* Fixed memory allocation issues with Swoole\Table (swoole/swoole-src@3e7770f) (@matyhtf)
* Fixed crash when Coroutine\Http2\Client connects concurrently (swoole/swoole-src@630536d) (@matyhtf)
* Fixed enable_ssl_encrypt with DTLS (swoole/swoole-src@842733b) (@matyhtf)
* Fixed Coroutine\Barrier mem leak (swoole/library#94) (@Appla) (@FMiS)
* Fixed the offset error caused by CURLOPT_PORT and CURLOPT_URL order (swoole/library#96) (@sy-records)
* Fixed Table::get($key, $field) when field type is float (swoole/swoole-src@08ea20c) (@matyhtf)
* Fixed Swoole\Table mem leaks (swoole/swoole-src@d78ca8c) (@matyhtf)
You can upgrade to Swoole v4.6.4 now:
pecl install openswoole
Join 4,000+ others and never miss out on new tips, tutorials, and more.