1--TEST-- 2curl_setopt basic tests with CURLOPT_STDERR. 3--CREDITS-- 4Paul Sohier 5#phptestfest utrecht 6--EXTENSIONS-- 7curl 8--FILE-- 9<?php 10 11include 'server.inc'; 12$host = curl_cli_server_start(); 13 14// start testing 15echo "*** Testing curl_setopt with CURLOPT_STDERR\n"; 16 17$temp_file = tempnam(sys_get_temp_dir(), 'CURL_STDERR'); 18 19$handle = fopen($temp_file, 'w'); 20 21$url = "{$host}/"; 22$ch = curl_init(); 23 24curl_setopt($ch, CURLOPT_VERBOSE, 1); 25curl_setopt($ch, CURLOPT_STDERR, $handle); 26$curl_content = curl_exec($ch); 27 28fclose($handle); 29unset($handle); 30var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file))); 31@unlink($temp_file); 32 33ob_start(); // start output buffering 34$handle = fopen($temp_file, 'w'); 35curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use 36curl_setopt($ch, CURLOPT_STDERR, $handle); 37$data = curl_exec($ch); 38ob_end_clean(); 39 40fclose($handle); 41unset($handle); 42var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file))); 43@unlink($temp_file); 44 45curl_close($ch); 46 47?> 48--EXPECTF-- 49*** Testing curl_setopt with CURLOPT_STDERR 50string(%d) "%S" 51string(%d) "%S" 52