1--TEST-- 2Test curl_copy_handle() with CURLOPT_XFERINFOFUNCTION 3--EXTENSIONS-- 4curl 5--FILE-- 6<?php 7include 'server.inc'; 8$host = curl_cli_server_start(); 9 10$url = "{$host}/get.inc"; 11$ch = curl_init($url); 12 13function foo() { 14 static $done = false; if (!$done) { echo "Download progress!\n"; $done = true; } 15} 16 17curl_setopt($ch, CURLOPT_NOPROGRESS, 0); 18curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 19curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, 'foo'); 20$ch2 = curl_copy_handle($ch); 21echo curl_exec($ch), PHP_EOL; 22unset($ch); 23echo curl_exec($ch2); 24 25?> 26--EXPECT-- 27Download progress! 28Hello World! 29Hello World! 30Hello World! 31Hello World! 32