PHP curl_copy_handle function
(PHP 5)
curl_copy_handle - Copy a cURL handle and all its options
Explanation
resource curl_copy_handle ( resource $ch )
Copy a cURL handle and keep the same option.
parameter
ch
By the curl_init () returns a cURL handle.
return value
Returns a new cURL handle.
Examples
Copy a cURL handle
<?php // 创建一个新的cURL资源 $ch = curl_init(); // 设置URL和相应的选项 curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/'); curl_setopt($ch, CURLOPT_HEADER, 0); // 复制句柄 $ch2 = curl_copy_handle($ch); // 抓取URL (http://www.example.com/) 并把它传递给浏览器 curl_exec($ch2); // 关闭cURL资源,并且释放系统资源 curl_close($ch2); curl_close($ch); ?>