xref: /PHP-7.1/ext/curl/tests/curl_reset.phpt (revision 54fee595)
1--TEST--
2Test curl_reset
3--SKIPIF--
4<?php if (!extension_loaded("curl")) print "skip";
5if (!function_exists("curl_reset")) exit("skip curl_reset doesn't exists (require libcurl >= 7.12.1)");
6?>
7--FILE--
8<?php
9
10$test_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
11$log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
12
13$fp = fopen($log_file, 'w+');
14fwrite($fp, "test");
15fclose($fp);
16
17$testfile_fp = fopen($test_file, 'w+');
18
19$ch = curl_init();
20curl_setopt($ch, CURLOPT_FILE, $testfile_fp);
21curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
22curl_exec($ch);
23
24curl_reset($ch);
25curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
26curl_exec($ch);
27
28curl_close($ch);
29
30fclose($testfile_fp);
31
32echo file_get_contents($test_file);
33
34// cleanup
35unlink($test_file);
36unlink($log_file);
37
38?>
39
40===DONE===
41--EXPECT--
42testtest
43===DONE===
44