curl_share_basic.phpt 654 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Basic curl_share test
  3. --EXTENSIONS--
  4. curl
  5. --FILE--
  6. <?php
  7. $sh = curl_share_init();
  8. $ch1 = curl_init();
  9. curl_setopt($ch1, CURLOPT_URL, 'file://' . __DIR__ . '/curl_testdata1.txt');
  10. curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  11. curl_setopt($ch1, CURLOPT_SHARE, $sh);
  12. $ch2 = curl_init();
  13. curl_setopt($ch2, CURLOPT_URL, 'file://' . __DIR__ . '/curl_testdata2.txt');
  14. curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
  15. curl_setopt($ch2, CURLOPT_SHARE, $sh);
  16. // Make sure nothing bad handles if the share handle is unset early.
  17. unset($sh);
  18. var_dump(curl_exec($ch1));
  19. var_dump(curl_exec($ch2));
  20. ?>
  21. --EXPECT--
  22. string(6) "CURL1
  23. "
  24. string(6) "CURL2
  25. "