1--TEST--
2Test curl_copy_handle() after exec() with POST
3--CREDITS--
4Rick Buitenman <rick@meritos.nl>
5#testfest Utrecht 2009
6--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10
11  include 'server.inc';
12  $host = curl_cli_server_start();
13
14  echo '*** Test curl_copy_handle() after exec() with POST ***' . "\n";
15
16  $url = "{$host}/get.php?test=getpost";
17  $ch = curl_init();
18
19  ob_start(); // start output buffering
20  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21  curl_setopt($ch, CURLOPT_POST, 1);
22  curl_setopt($ch, CURLOPT_POSTFIELDS, "Hello=World&Foo=Bar&Person=John%20Doe");
23  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
24
25
26  $curl_content = curl_exec($ch);
27  $copy = curl_copy_handle($ch);
28  curl_close($ch);
29
30  $curl_content_copy = curl_exec($copy);
31  curl_close($copy);
32
33  var_dump( $curl_content_copy );
34?>
35===DONE===
36--EXPECT--
37*** Test curl_copy_handle() after exec() with POST ***
38string(163) "array(1) {
39  ["test"]=>
40  string(7) "getpost"
41}
42array(3) {
43  ["Hello"]=>
44  string(5) "World"
45  ["Foo"]=>
46  string(3) "Bar"
47  ["Person"]=>
48  string(8) "John Doe"
49}
50"
51===DONE===
52