English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP curl_share_init() Function Usage and Example 5 (PHP 5>=5.
.0)
Syntax
resource curl_share_init ( void )
Parameters
Return Value
Online Example
This example will create a CURL shared handle and add two CURL handles, sharing cookie data between the two handles. // <?php Create a CURL shared handle and set cookie data $sh = curl_share_init(); // curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); Initialize the second CURL handle and specify it as a shared handle1 $ch//Initialize the first CURL handle and specify it as a shared handle3codebox.com/php.net ");1, CURLOPT_SHARE, $sh); // www.w curl_exec($ch1); // Execute the first CURL handle Initialize the second CURL handle and specify it as a shared handle2 $ch//= curl_init("http:/php.net ");2, CURLOPT_SHARE, $sh); // Execute the second CURL handle // All $ch1 The data in handle $ch2 Shared in handle curl_exec($ch2); // Close CURL shared handle curl_share_close($sh); // Close CURL handle curl_close($ch1); curl_close($ch2); ?>