|
|
curl_copy_handle (PHP 5) curl_copy_handle -- Copy a cURL handle along with all of its preferences Описаниеresource curl_copy_handle ( resource ch )
Copies a cURL handle keeping the same preferences.
Возвращаемые значения
Returns a new cURL handle.
Примеры
Пример 1. Copying a cURL handle |
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/');
curl_setopt($ch, CURLOPT_HEADER, 0);
$ch2 = curl_copy_handle($ch);
curl_exec($ch2);
curl_close($ch2);
curl_close($ch);
?>
|
|
add a note
User Contributed Notes
curl_copy_handle
nicolac76 at yahoo dot fr
03-Sep-2007 03:14
Something work wrong if you use the var $i for a for...
$i cannot go over 127 (0111 1111b), more over you must say that the var is an int...
<?
$j=(int)0;
$curl = curl_init("http://www.example.com");
for($j=1;$j<=128;$j++) {
$ch = curl_copy_handle($curl);
curl_close($ch);
}
curl_close($curl);
?>
Andrew
19-May-2007 11:39
You can use it for some kind of templates:
<?php
$ch = array();
$ch[0] = curl_init();
curl_setopt($ch[0], CURLOPT_URL, 'http://beengo.net/');
curl_setopt($ch[0], CURLOPT_HEADER, 0);
curl_setopt($ch[0], CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch[0], CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch[0], CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$ch[1] = curl_copy_handle($ch[0]);
curl_setopt($ch[1], CURLOPT_URL, 'http://beengo.net/cells/list');
$ch[2] = curl_copy_handle($ch[0]);
curl_setopt($ch[2], CURLOPT_URL, 'http://beengo.net/cells/list?q=travel');
?>
|