curl_reset.phpt 660 B

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