1--TEST--
2Test curl option CURLOPT_RETURNTRANSFER
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 have it return the content from curl_exec(). Tests the PHP_CURL_RETURN case
8of curl_write().
9--SKIPIF--
10<?php if (!extension_loaded("curl")) print "skip"; ?>
11--FILE--
12<?php
13
14$log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
15
16$fp = fopen($log_file, 'w+');
17fwrite($fp, "test");
18fclose($fp);
19
20$ch = curl_init();
21curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
22curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
23$result = curl_exec($ch);
24curl_close($ch);
25
26echo $result;
27
28// cleanup
29unlink($log_file);
30
31?>
32--EXPECT--
33test
34