Skip to content

Releases: workerman-php/http-client

v2.1.4

Choose a tag to compare

@walkor walkor released this 06 Apr 13:16
fd14c4f
  • 非协程调用url参数非法不直接抛出异常

Full Changelog: v2.1.3...v2.1.4

v2.1.3

Choose a tag to compare

@walkor walkor released this 09 Mar 00:55
ca767c7

What's Changed

  • 修复携程池 超时等网络错误导致插件无限重启的问题 by @youfeed in #21

New Contributors

Full Changelog: v2.1.2...v2.1.3

v2.1.2

Choose a tag to compare

@walkor walkor released this 07 Mar 09:19
eb4acf8

Full Changelog: v2.1.1...v2.1.2

v2.1.1

Choose a tag to compare

@walkor walkor released this 03 Jan 05:59
212fcd5

What's Changed

New Contributors

Full Changelog: v2.1.0...v2.1.1

v2.1.0

Choose a tag to compare

@walkor walkor released this 03 Jan 02:31
  • Support progress option
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Connection\TcpConnection;
use Workerman\Http\Client;
use Workerman\Protocols\Http\Chunk;
use Workerman\Protocols\Http\Request;
use Workerman\Protocols\Http\Response;
use Workerman\Worker;

$worker = new Worker('http://0.0.0.0:1234');
$worker->onMessage = function (TcpConnection $connection, Request $request) {
    $http = new Client();
    $http->request('https://api.openai.com/v1/chat/completions', [
        'method' => 'POST',
        'data' => json_encode([
            'model' => 'gpt-3.5-turbo',
            'temperature' => 1,
            'stream' => true,
            'messages' => [['role' => 'user', 'content' => 'hello']],
        ]),
        'headers' => [
            'Content-Type' => 'application/json',
            'Authorization' => 'Bearer sk-xx',
        ],
        'progress' => function($buffer) use ($connection) {
            $connection->send(new Chunk($buffer));
        },
        'success' => function($response) use ($connection) {
            $connection->send(new Chunk(''));
        },
    ]);
    $connection->send(new Response(200, [
        //"Content-Type" => "application/octet-stream",
        "Transfer-Encoding" => "chunked",
    ], ' '));
};
Worker::runAll();

Full Changelog: v2.0.1...v2.1.0

v2.0.1

Choose a tag to compare

@walkor walkor released this 03 Feb 11:54
fec1155
  • Add return type

Full Changelog: v2.0.0...v2.0.1

v2.0.0

Choose a tag to compare

@walkor walkor released this 01 Feb 09:21
  • Support workerman v5

Full Changelog: v1.0.11...v2.0.0

v1.0.11

Choose a tag to compare

@walkor walkor released this 16 Dec 09:45
c8376b5

Full Changelog: v1.0.10...v1.0.11

v1.0.10

Choose a tag to compare

@walkor walkor released this 12 Sep 10:21
c433c11

What's Changed

New Contributors

Full Changelog: 1.0.10...v1.0.10

1.0.10

Choose a tag to compare

@walkor walkor released this 05 Sep 05:15
d2e52ce

What's Changed

New Contributors

Full Changelog: v1.0.9...1.0.10