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

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP curl_copy_handle() Function Usage and Example

PHP CURL Reference Manual

(PHP 5)

curl_copy_handle — Copy a CURL handle and all its options

Syntax

resource  curl_copy_handle  (  resource  $ch  )

Copy a CURL handle and maintain the same options.

Parameter

ch

The CURL handle returned by curl_init().

Return Value

Return a new CURL handle.

Online Examples

Copy a CURL handle

<?php
// Create a new CURL resource
$ch = curl_init();
// Set the URL and corresponding options
curl_setopt($ch, CURLOPT_URL, 'http://www.oldtoolbag.com/');
curl_setopt($ch, CURLOPT_HEADER, 0);
// Copy the handle
$ch2 =  curl_copy_handle($ch);
// Crawl URL (http://www.oldtoolbag.com/)  and pass it to the browser
curl_exec($ch2);
// Close the CURL resource and release system resources
curl_close($ch2);
curl_close($ch);
?>

PHP CURL Reference Manual