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