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.php?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===DONE===
33--EXPECTF--
34*** Testing curl copy handle with simple POST ***
35string(163) "array(1) {
36  ["test"]=>
37  string(7) "getpost"
38}
39array(3) {
40  ["Hello"]=>
41  string(5) "World"
42  ["Foo"]=>
43  string(3) "Bar"
44  ["Person"]=>
45  string(8) "John Doe"
46}
47"
48===DONE===
49