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