xref: /PHP-8.3/ext/curl/tests/curl_reset.phpt (revision ca423a1b)
1--TEST--
2Test curl_reset
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7
8$test_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
9$log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
10
11$fp = fopen($log_file, 'w+');
12fwrite($fp, "test");
13fclose($fp);
14
15$testfile_fp = fopen($test_file, 'w+');
16
17$ch = curl_init();
18curl_setopt($ch, CURLOPT_FILE, $testfile_fp);
19curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
20curl_exec($ch);
21
22curl_reset($ch);
23curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
24curl_exec($ch);
25
26curl_close($ch);
27
28fclose($testfile_fp);
29
30echo file_get_contents($test_file);
31
32// cleanup
33unlink($test_file);
34unlink($log_file);
35?>
36--EXPECT--
37testtest
38