curl_reset

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

curl_resetReset all options of a libcurl session handle

Опис

curl_reset(CurlHandle $handle): void

This function re-initializes all options set on the given cURL handle to the default values.

Параметри

ch

cURL-дескриптор, якого повертає curl_init().

Значення, що повертаються

Не повертає значень.

Журнал змін

Версія Опис
8.0.0 handle тепер має бути примірником класу CurlHandle; раніше очікувався resource.

Приклади

Приклад #1 curl_reset() example

<?php
// Create a curl handle
$ch = curl_init();

// Set CURLOPT_USERAGENT option
curl_setopt($ch, CURLOPT_USERAGENT, "My test user-agent");

// Reset all previously set options
curl_reset($ch);

// Send HTTP request
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
curl_exec($ch); // the previously set user-agent will be not sent, it has been reset by curl_reset

// Close the handle
curl_close($ch);
?>

Примітки

Зауваження:

curl_reset() also resets the URL given as the curl_init() parameter.

Прогляньте також