English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP curl_multi_close() Function Usage and Example

PHP CURL Reference Manual

(PHP 5)

curl_multi_close — Close a group of CURL handles

Syntax

void curl_multi_close ( resource $mh )

Close a group of CURL handles.

parameter

mh

The CURL multiple handles returned by curl_multi_init().

Return value

No return value.

Online example

This example will create2Create a batch of CURL handles, add them to the batch handle, and then run them in parallel.

<?php
// Create a pair of CURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// Set URL and corresponding options
curl_setopt($ch1, CURLOPT_URL, "http://www.oldtoolbag.com/);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/);
curl_setopt($ch2, CURLOPT_HEADER, 0);
// Create batch CURL handle
$mh = curl_multi_init();
// add2handle
curl_multi_add_handle($mh, $ch1);
curl_multi_add_handle($mh, $ch2);
$running = null;
// Execute batch handle
do {
    curl_multi_exec($mh, $running);
} while ($running > 0);
// Close all handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>

PHP CURL Reference Manual