Annotation of embedaddon/php/ext/curl/tests/curl_write_stdout.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test curl option CURLOPT_FILE with STDOUT handle
3: --CREDITS--
4: Mathieu Kooiman <mathieuk@gmail.com>
5: Dutch UG, TestFest 2009, Utrecht
6: --DESCRIPTION--
7: Writes 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+');
16: fwrite($fp, "test");
17: fclose($fp);
18:
19: $ch = curl_init();
20: curl_setopt($ch, CURLOPT_FILE, STDOUT);
21: curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
22: curl_exec($ch);
23: curl_close($ch);
24:
25: // cleanup
26: unlink($log_file);
27:
28: ?>
29: --EXPECT--
30: test
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>