I need to POST the following JSON code, but for some reason it is not working. Below is the code that I have.
$fieldString = \"395609399\";
//the curl reques
The bit that is the problem is:
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode("{categoryId: $fieldString}"));
CURLOPT_POSTFIELDS will accept either an array of parameters, or a URL-encoded string of parameters:
curl_setopt($ch, CURLOPT_POSTFIELDS, array('json'=>json_encode($stuff)));
curl_setopt($ch, CURLOPT_POSTFIELDS, 'json='.urlencode(json_encode($stuff)));
Where json will be the name of the POST field (i.e.: will result in $_POST['json'] being accessible).