xref: /PHP-5.6/ext/curl/tests/bug55767.phpt (revision c507c9f0)
1--TEST--
2Test curl_opt() function with POST params from array with a numeric key
3--SKIPIF--
4<?php
5include 'skipinf.inc';
6?>
7--FILE--
8<?php
9/* Prototype  : bool curl_setopt(resource ch, int option, mixed value)
10 * Description: Set an option for a cURL transfer
11 * Source code: ext/curl/interface.c
12 * Alias to functions:
13 */
14
15  include 'server.inc';
16  $host = curl_cli_server_start();
17
18  // start testing
19  echo '*** Testing curl sending through GET an POST ***' . "\n";
20
21  $url = "{$host}/get.php?test=getpost&get_param=Hello%20World";
22  $ch = curl_init();
23
24  ob_start(); // start output buffering
25  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
26  curl_setopt($ch, CURLOPT_POST, 1);
27  curl_setopt($ch, CURLOPT_POSTFIELDS, array('Hello'=>'World','Foo'=>'Bar',100=>'John Doe'));
28  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
29
30  $curl_content = curl_exec($ch);
31  curl_close($ch);
32
33  var_dump( $curl_content );
34?>
35===DONE===
36--EXPECTF--
37*** Testing curl sending through GET an POST ***
38string(203) "array(2) {
39  ["test"]=>
40  string(7) "getpost"
41  ["get_param"]=>
42  string(11) "Hello World"
43}
44array(3) {
45  ["Hello"]=>
46  string(5) "World"
47  ["Foo"]=>
48  string(3) "Bar"
49  [100]=>
50  string(8) "John Doe"
51}
52"
53===DONE===
54