1--TEST--
2Test curl_copy_handle() with simple POST
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
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===DONE===
31--EXPECT--
32*** Testing curl copy handle with simple POST using array as arguments ***
33string(163) "array(1) {
34  ["test"]=>
35  string(7) "getpost"
36}
37array(3) {
38  ["Hello"]=>
39  string(5) "World"
40  ["Foo"]=>
41  string(3) "Bar"
42  ["Person"]=>
43  string(8) "John Doe"
44}
45"
46===DONE===
47