1--TEST-- 2Test curl_copy_handle() add options to the handles 3--CREDITS-- 4Francesco Fullone ff@ideato.it 5#PHPTestFest Cesena Italia on 2009-06-20 6--SKIPIF-- 7<?php 8 if (!extension_loaded("curl")) exit("skip curl extension not loaded"); 9?> 10--DESCRIPTION-- 11the only way to test if a option is setten on a curl handle is using the curl_getinfo() function. 12but this can only check on a limited amount of options... 13--FILE-- 14<?php 15echo "*** Testing curl_copy_handle(): add options after copy ***\n"; 16 17// create a new cURL resource 18$ch = curl_init(); 19 20// copy the handle 21$ch2 = curl_copy_handle($ch); 22var_dump(curl_getinfo($ch) === curl_getinfo($ch2)); 23 24// add some CURLOPT to the second handle 25curl_setopt($ch2, CURLOPT_URL, 'http://www.example.com/'); 26 27var_dump(curl_getinfo($ch) === curl_getinfo($ch2)); 28 29// add same CURLOPT to the first handle 30curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/'); 31var_dump(curl_getinfo($ch) === curl_getinfo($ch2)); 32 33// change a CURLOPT in the second handle 34curl_setopt($ch2, CURLOPT_URL, 'http://www.bar.com/'); 35var_dump(curl_getinfo($ch) === curl_getinfo($ch2)); 36?> 37--EXPECT-- 38*** Testing curl_copy_handle(): add options after copy *** 39bool(true) 40bool(false) 41bool(true) 42bool(false) 43