1--TEST--
2Test curl_copy_handle() with simple POST
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7  include 'server.inc';
8  $host = curl_cli_server_start();
9
10  echo '*** Testing curl copy handle with simple POST using array as arguments ***' . "\n";
11
12  $url = "{$host}/get.inc?test=getpost";
13  $ch = curl_init();
14
15  ob_start(); // start output buffering
16  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
17  curl_setopt($ch, CURLOPT_POST, 1);
18  curl_setopt($ch, CURLOPT_POSTFIELDS, array("Hello" => "World", "Foo" => "Bar", "Person" => "John Doe"));
19  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // Disable Expect: header (lighttpd does not support it :)
20  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
21
22  $copy = curl_copy_handle($ch);
23  curl_close($ch);
24
25  $curl_content = curl_exec($copy);
26  curl_close($copy);
27
28  var_dump( $curl_content );
29?>
30--EXPECT--
31*** Testing curl copy handle with simple POST using array as arguments ***
32string(163) "array(1) {
33  ["test"]=>
34  string(7) "getpost"
35}
36array(3) {
37  ["Hello"]=>
38  string(5) "World"
39  ["Foo"]=>
40  string(3) "Bar"
41  ["Person"]=>
42  string(8) "John Doe"
43}
44"
45