1--TEST-- 2Test curl_copy_handle() with User Agent 3--CREDITS-- 4Rick Buitenman <rick@meritos.nl> 5#testfest Utrecht 2009 6--SKIPIF-- 7<?php include 'skipif.inc'; ?> 8--FILE-- 9<?php 10 11 include 'server.inc'; 12 $host = curl_cli_server_start(); 13 14 echo '*** Testing curl copy handle with User Agent ***' . "\n"; 15 16 $url = "{$host}/get.inc?test=useragent"; 17 $ch = curl_init(); 18 19 ob_start(); // start output buffering 20 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 21 curl_setopt($ch, CURLOPT_USERAGENT, 'cURL phpt'); 22 curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use 23 24 $copy = curl_copy_handle($ch); 25 26 var_dump( curl_exec($ch) ); 27 var_dump( curl_exec($copy) ); 28 29 curl_close($ch); // can not close original handle before curl_exec($copy) since it causes char * inputs to be invalid (see also: http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html) 30 curl_close($copy); 31 32?> 33===DONE=== 34--EXPECT-- 35*** Testing curl copy handle with User Agent *** 36string(9) "cURL phpt" 37string(9) "cURL phpt" 38===DONE=== 39