1--TEST-- 2CURLOPT_POSTFIELDS with multi-value fields 3--EXTENSIONS-- 4curl 5sockets 6--FILE-- 7<?php 8$socket = stream_socket_server("tcp://0.0.0.0:29999", $errno, $errstr); 9 10if (!$socket) { 11 echo "$errstr ($errno)<br />\n"; 12 return; 13} 14 15$url = "http://127.0.0.1:29999/get.inc?test=raw"; 16 17$fields = [ 18 'single' => 'SingleValue', 19 'multi' => [ 20 'Multi1', 21 'Multi2', 22 ] 23]; 24 25$options = [ 26 CURLOPT_POST => 1, 27 CURLOPT_HEADER => 0, 28 CURLOPT_URL => $url, 29 CURLOPT_FRESH_CONNECT => 1, 30 CURLOPT_RETURNTRANSFER => 1, 31 CURLOPT_FORBID_REUSE => 1, 32 CURLOPT_TIMEOUT => 1, 33 CURLOPT_POSTFIELDS => $fields, 34 CURLOPT_HTTPHEADER => [ 'Expect:' ], 35]; 36 37$ch = curl_init(); 38curl_setopt_array($ch, $options); 39 40$curl_content = curl_exec($ch); 41curl_close($ch); 42 43$conn = stream_socket_accept($socket); 44echo stream_get_contents($conn); 45?> 46--EXPECTF-- 47POST /get.inc?test=raw HTTP/1.1 48Host: %s 49Accept: */* 50Content-Length: %d 51Content-Type: multipart/form-data; boundary=------------------------%s 52 53--------------------------%s 54Content-Disposition: form-data; name="single" 55 56SingleValue 57--------------------------%s 58Content-Disposition: form-data; name="multi" 59 60Multi1 61--------------------------%s 62Content-Disposition: form-data; name="multi" 63 64Multi2 65--------------------------%s-- 66