1--TEST--
2Test curl option CURLOPT_FILE with STDOUT handle
3--CREDITS--
4Mathieu Kooiman <mathieuk@gmail.com>
5Dutch UG, TestFest 2009, Utrecht
6--DESCRIPTION--
7Writes the value 'test' to a temporary file. Use curl to access this file and store the output in another temporary file. Tests the PHP_CURL_FILE case in curl_write().
8--SKIPIF--
9<?php if (!extension_loaded("curl")) print "skip"; ?>
10--FILE--
11<?php
12
13$log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
14
15$fp = fopen($log_file, 'w+');
16fwrite($fp, "test");
17fclose($fp);
18
19$ch = curl_init();
20curl_setopt($ch, CURLOPT_FILE, STDOUT);
21curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
22curl_exec($ch);
23curl_close($ch);
24
25// cleanup
26unlink($log_file);
27
28?>
29--EXPECT--
30test
31