Using PHP, Curl (ZF2), I need to submit via POST method RAW field values to third party API.
When i send it as following, it does not work, SERVER refuse to accept:
$ss = array(
'id'=> array('a1','b2')
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $ss); // FAIL
or
$ss = array(
'id'=> 'a1,b2'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $ss); // FAIL
or
curl_setopt($ch, CURLOPT_POSTFIELDS,'id=a1,b2'); // FAIL
or
curl_setopt($ch, CURLOPT_POSTFIELDS,'&id=a1,b2'); // FAIL
But when i manually send it as following, SERVER accepts it, and it works:
curl_setopt($ch, CURLOPT_POSTFIELDS,'{
"id": [
"a1",
"b2"
]
}');
How do i submit array $ss
in that format which is getting accepted?