Swoole Hook Native CURL

Notice: ext-swoole is supported until v4.7.1, use ext-openswoole >= v4.7.1. Latest version: pecl install openswoole-4.10.0

The SWOOLE_HOOK_NATIVE_CURL flag will enable coroutine support for the CURL library (libcurl). Support was added in v4.6.0.

You must run --enable-swoole-curl when you install Swoole to enable CURL support. By enabling this it will automatically set the SWOOLE_HOOK_NATIVE_CURL flag and turn off SWOOLE_HOOK_CURL.

When using SWOOLE_HOOK_NATIVE_CURL it is enabled by default with SWOOLE_HOOK_ALL



Co::set(['hook_flags' => SWOOLE_HOOK_ALL]);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://swoole.co.uk");
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec($ch);