HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

curl_pause

Description

The curl_pause of cURL for PHP pause and unpause a connection.

Syntax

curl_pause(
    CurlHandle $handle,
    int $flags
): int

Parameters

handle

A cURL handle returned by curl_init().

flags

One of CURLPAUSE_* constants.

ConstantValueDescription
CURLPAUSE_ALL5Pause sending and receiving data.
CURLPAUSE_CONT0Unpause sending and receiving data.
CURLPAUSE_RECV1Pause receiving data.
CURLPAUSE_RECV_CONT0Unpause receiving data.
CURLPAUSE_SEND4Pause sending data.
CURLPAUSE_SEND_CONT0Unpause sending data.

Return

Returns an error code (CURLE_OK for no error).

Examples

1 · handle flags

<?

$handle = curl_init();

    curl_setopt($handle, CURLOPT_URL, "https://osbo.com/");
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);

    curl_exec($handle);

    $flags1 = CURLPAUSE_ALL;

    curl_pause($handle, $flags1);

    echo "pause sending and receiving data" . PHP_EOL;

    $flags2 = CURLPAUSE_CONT;

    curl_pause($handle, $flags2);

    echo "unpause sending and receiving data";

curl_close($handle);
pause sending and receiving data
unpause sending and receiving data