1--TEST--
2Test curl_copy_handle() after exec() with POST
3--CREDITS--
4Rick Buitenman <rick@meritos.nl>
5#testfest Utrecht 2009
6--EXTENSIONS--
7curl
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.inc?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--EXPECT--
36*** Test curl_copy_handle() after exec() with POST ***
37string(163) "array(1) {
38  ["test"]=>
39  string(7) "getpost"
40}
41array(3) {
42  ["Hello"]=>
43  string(5) "World"
44  ["Foo"]=>
45  string(3) "Bar"
46  ["Person"]=>
47  string(8) "John Doe"
48}
49"
50