1--TEST--
2Test curl_copy_handle() after exec()
3--CREDITS--
4Rick Buitenman <rick@meritos.nl>
5#testfest Utrecht 2009
6--SKIPIF--
7<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
8--FILE--
9<?php
10
11  $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
12
13  echo '*** Test curl_copy_handle() after exec() ***' . "\n";
14
15  $url = "{$host}/get.php?test=getpost&get_param=Hello%20World";
16  $ch = curl_init();
17
18  ob_start(); // start output buffering
19  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
20  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
21
22
23  $curl_content = curl_exec($ch);
24  $copy = curl_copy_handle($ch);
25  curl_close($ch);
26
27  $curl_content_copy = curl_exec($copy);
28  curl_close($copy);
29
30  var_dump( $curl_content_copy );
31?>
32===DONE===
33--EXPECTF--
34*** Test curl_copy_handle() after exec() ***
35string(106) "array(2) {
36  ["test"]=>
37  string(7) "getpost"
38  ["get_param"]=>
39  string(11) "Hello World"
40}
41array(0) {
42}
43"
44===DONE===
45