xref: /PHP-8.2/ext/curl/tests/bug55767.phpt (revision 8567bc10)
1--TEST--
2Test curl_opt() function with POST params from array with a numeric key
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7  include 'server.inc';
8  $host = curl_cli_server_start();
9
10  // start testing
11  echo '*** Testing curl sending through GET an POST ***' . "\n";
12
13  $url = "{$host}/get.inc?test=getpost&get_param=Hello%20World";
14  $ch = curl_init();
15
16  ob_start(); // start output buffering
17  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
18  curl_setopt($ch, CURLOPT_POST, 1);
19  curl_setopt($ch, CURLOPT_POSTFIELDS, array('Hello'=>'World','Foo'=>'Bar',100=>'John Doe'));
20  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
21
22  $curl_content = curl_exec($ch);
23  curl_close($ch);
24
25  var_dump( $curl_content );
26?>
27--EXPECT--
28*** Testing curl sending through GET an POST ***
29string(203) "array(2) {
30  ["test"]=>
31  string(7) "getpost"
32  ["get_param"]=>
33  string(11) "Hello World"
34}
35array(3) {
36  ["Hello"]=>
37  string(5) "World"
38  ["Foo"]=>
39  string(3) "Bar"
40  [100]=>
41  string(8) "John Doe"
42}
43"
44